From b2b26617f025c319134505700af5a44228972cc2 Mon Sep 17 00:00:00 2001 From: leonidarider <358984476+leonidarider@users.noreply.github.com> Date: Thu, 3 Dec 2026 02:30:38 +0100 Subject: [PATCH] refactor: organize src/state into subdirs/tests and eliminate GTA6 #[path] flattening (desloppify wave 5E-1) - Replace all 382 #[path = "..."] directives in or-io/src/gta6/ (346 -> 0, including script/, script/passes/, headerless/, map/, ttpf/, save/, audio/, water/), or-world-gta6/src/ (33 -> 0: edit/, index/, stream/, day/), and or-cli/src/gta6/ (3 -> 0) with standard Rust mod.rs subdirectories while preserving all public API paths. - Relocate all 145 flat #[cfg(test)] files plus copy_cut_and_paste/ and the_files_view_in_the_centre/ out of src/state/ into src/state/tests/ wired from one #[cfg(test)] pub(crate) mod tests;. - Move src/state/rpf9_tree_row_kind.rs into src/state/files_view/ (removing the upward #[path]) and group all gta6_* and rpf* production modules into src/state/gta6/ (10 subdirs) and src/state/rpf/, eliminating all 111 #[path] attributes in src/state/ and shrinking top-level entries from 412 -> 100. - Update .config/nextest.toml, xtask/src/slow_tier.rs, path-based test checks, and doc citations (0 mixed mod.rs/file+dir sibling dirs across the repo). --- .config/nextest.toml | 206 ++++----- LICENSE-third-party.md | 6 +- .../src/day/{exposure.rs => exposure/mod.rs} | 1 - .../{exposure_tests.rs => exposure/tests.rs} | 0 .../src/day/{frame.rs => frame/mod.rs} | 1 - .../day/{frame_tests.rs => frame/tests.rs} | 0 crates/domain/or-world-gta6/src/day/mod.rs | 1 - .../src/day/{sky.rs => sky/mod.rs} | 1 - .../src/day/{sky_tests.rs => sky/tests.rs} | 0 .../src/day/{sun.rs => sun/mod.rs} | 1 - .../src/day/{sun_tests.rs => sun/tests.rs} | 0 .../src/day/{day_tests.rs => tests.rs} | 0 .../src/day/{vars.rs => vars/mod.rs} | 1 - .../src/day/{vars_tests.rs => vars/tests.rs} | 0 .../src/day/{weather.rs => weather/mod.rs} | 1 - .../{weather_tests.rs => weather/tests.rs} | 0 .../src/day/{wind.rs => wind/mod.rs} | 1 - .../src/day/{wind_tests.rs => wind/tests.rs} | 0 .../entities/made_up.rs} | 0 .../entities/mod.rs} | 2 - .../entities/tests.rs} | 0 .../src/{edit_extents.rs => edit/extents.rs} | 0 .../src/{edit.rs => edit/mod.rs} | 3 - .../src/{edit_tests.rs => edit/tests.rs} | 0 .../{index_install.rs => index/install.rs} | 0 .../src/{index.rs => index/mod.rs} | 7 - .../{index_mount.rs => index/mount/mod.rs} | 1 - .../mount/tests.rs} | 0 .../src/{index_open.rs => index/open/mod.rs} | 1 - .../open/tests.rs} | 0 .../src/{index_rows.rs => index/rows.rs} | 0 .../src/{index_scan.rs => index/scan.rs} | 0 .../scan_table/mod.rs} | 1 - .../scan_table/tests.rs} | 0 .../{index_states.rs => index/states/mod.rs} | 1 - .../states/tests.rs} | 0 .../{stream_census.rs => stream/census.rs} | 0 .../src/{stream_grass.rs => stream/grass.rs} | 0 .../src/{stream_laid.rs => stream/laid.rs} | 0 .../src/{stream.rs => stream/mod.rs} | 8 - .../{stream_pick.rs => stream/pick/mod.rs} | 1 - .../pick/tests.rs} | 0 .../src/{stream_read.rs => stream/read.rs} | 0 .../src/{stream_slod.rs => stream/slod.rs} | 0 .../src/{stream_tests.rs => stream/tests.rs} | 0 .../src/{stream_world.rs => stream/world.rs} | 0 ...leaves_a_folder_in_the_temporary_folder.rs | 8 +- .../src/gta6/accel/{build.rs => build/mod.rs} | 1 - .../accel/{build_tests.rs => build/tests.rs} | 0 .../accel/{intersect.rs => intersect/mod.rs} | 1 - .../tests.rs} | 0 .../src/gta6/accel/{query.rs => query/mod.rs} | 1 - .../accel/{query_tests.rs => query/tests.rs} | 0 .../src/gta6/accel/{refit.rs => refit/mod.rs} | 1 - .../accel/{refit_tests.rs => refit/tests.rs} | 0 .../gta6/accel/{select.rs => select/mod.rs} | 1 - .../{select_tests.rs => select/tests.rs} | 0 .../src/gta6/accel/{walk.rs => walk/mod.rs} | 2 - .../accel/{walk_tests.rs => walk/tests.rs} | 0 .../src/gta6/accel/{ => walk}/wave_tests.rs | 0 .../gta6/anim/{columns.rs => columns/mod.rs} | 1 - .../{columns_tests.rs => columns/tests.rs} | 0 .../anim/{databases.rs => databases/mod.rs} | 1 - .../tests.rs} | 0 .../{expressions.rs => expressions/mod.rs} | 1 - .../tests.rs} | 0 .../group_d/mod.rs} | 1 - .../group_d/tests.rs} | 0 .../mod.rs} | 3 - .../shape_tests.rs} | 0 .../tests.rs} | 0 .../{matcher_levels.rs => matcher/levels.rs} | 0 .../gta6/anim/{matcher.rs => matcher/mod.rs} | 2 - .../{matcher_tests.rs => matcher/tests.rs} | 0 .../anim/{metadata.rs => metadata/mod.rs} | 1 - .../{metadata_tests.rs => metadata/tests.rs} | 0 crates/io/or-io/src/gta6/anim/mod.rs | 1 - .../clip_signature.rs} | 0 .../clip_signature_build/mod.rs} | 1 - .../clip_signature_build/replace.rs} | 0 .../gta6/anim/{anim_tests.rs => tests/mod.rs} | 10 - .../motion_loop/mod.rs} | 1 - .../motion_loop/on_the_build.rs} | 0 .../anim/{write_tests.rs => tests/write.rs} | 0 .../write_derived_and_grown.rs} | 0 .../write_edit.rs} | 0 .../write_in_extent.rs} | 0 .../write_mapped.rs} | 0 .../write_relayout.rs} | 0 .../write_replace.rs} | 0 .../src/gta6/anim/{write.rs => write/mod.rs} | 0 .../gta6/{anim_scene.rs => anim_scene/mod.rs} | 1 - .../tests.rs} | 0 .../gta6/{audio_data.rs => audio/data/mod.rs} | 1 - .../data/tests.rs} | 0 .../gta6/{ => audio/links}/audio_layouts.txt | 0 .../{ => audio/links}/audio_value_types.txt | 0 .../{audio_links.rs => audio/links/mod.rs} | 6 +- .../links/tables.rs} | 2 +- .../links/tests.rs} | 0 crates/io/or-io/src/gta6/audio/mod.rs | 5 + .../{audio_radio.rs => audio/radio/mod.rs} | 7 +- .../radio/tests.rs} | 0 .../src/gta6/bcpack/{bc6h.rs => bc6h/mod.rs} | 1 - .../bcpack/{bc6h_tests.rs => bc6h/tests.rs} | 0 .../src/gta6/bcpack/{bptc.rs => bptc/mod.rs} | 1 - .../bcpack/{bptc_tests.rs => bptc/tests.rs} | 0 .../gta6/bcpack/{ => calibrate}/bc6h_fit.rs | 0 .../gta6/bcpack/{ => calibrate}/bptc_fit.rs | 0 .../bcpack/{calibrate.rs => calibrate/mod.rs} | 5 +- .../tests.rs} | 0 .../{encode_rans.rs => encode/entropy.rs} | 0 .../gta6/bcpack/{encode.rs => encode/mod.rs} | 5 - .../{encode_bc1.rs => encode/of_bc1.rs} | 0 .../{encode_bc6h.rs => encode/of_bc6h.rs} | 0 .../{encode_bc7.rs => encode/of_bc7.rs} | 0 .../{encode_tests.rs => encode/tests.rs} | 0 .../bcpack/{supplied.rs => supplied/mod.rs} | 1 - .../{supplied_tests.rs => supplied/tests.rs} | 0 .../src/gta6/{dialogue.rs => dialogue/mod.rs} | 1 - .../{dialogue_tests.rs => dialogue/tests.rs} | 0 .../headerless/{forest.rs => forest/mod.rs} | 1 - .../{forest_tests.rs => forest/tests.rs} | 0 .../mod.rs} | 1 - .../tests.rs} | 0 crates/io/or-io/src/gta6/headerless/mod.rs | 94 ++-- .../{particles_bits.rs => particles/bits.rs} | 0 .../colour_word.rs} | 0 .../copier.rs} | 0 .../dup/event_object.rs} | 0 .../dup/mod.rs} | 1 - .../fields_word.rs} | 0 .../{particles_gpu.rs => particles/gpu.rs} | 0 .../{particles_keys.rs => particles/keys.rs} | 0 .../{particles.rs => particles/mod.rs} | 12 - .../{particles_open.rs => particles/parts.rs} | 0 .../remover.rs} | 0 .../tables.rs} | 0 .../tests/copied.rs} | 0 .../tests/duplicated/event_object.rs} | 0 .../tests/duplicated/mod.rs} | 1 - .../tests/keys_added.rs} | 0 .../tests/mod.rs} | 5 - .../tests/open.rs} | 0 .../tests/remove.rs} | 0 .../writer.rs} | 0 .../headerless/{small.rs => small/mod.rs} | 1 - .../{small_tests.rs => small/tests.rs} | 0 .../tests/{bound.rs => bound/mod.rs} | 3 - .../write_bound_grow/mod.rs} | 2 - .../write_bound_plain_copy.rs | 0 .../write_bound_grow}/write_bound_runs.rs | 2 +- .../tests/{ => bound}/write_bound_reshape.rs | 0 .../tests/{ => bound}/write_bound_vertex.rs | 0 .../tests/filter_signature_build.rs | 2 +- .../tests/{fragment.rs => fragment/mod.rs} | 1 - .../{ => fragment}/write_fragment_child.rs | 0 .../tests/{navmesh.rs => navmesh/mod.rs} | 2 - .../tests/{ => navmesh}/write_navmesh.rs | 0 .../write_navmesh_delete/mod.rs} | 2 - .../write_navmesh_links.rs | 0 .../write_navmesh_no_cell.rs | 0 .../bone_names.rs} | 8 +- .../bound_grow.rs} | 24 +- .../bound_reshape.rs} | 12 +- .../bound_runs.rs} | 14 +- .../bound_values.rs} | 14 +- .../bound_vertex.rs} | 12 +- .../headerless/{write_bvh.rs => write/bvh.rs} | 6 +- .../dictionary/mod.rs} | 11 +- .../dictionary/tests.rs} | 0 .../dictionary_entries.rs} | 6 +- .../dictionary_textures/mod.rs} | 5 +- .../dictionary_textures/tests.rs} | 0 .../{write_embedded.rs => write/embedded.rs} | 6 +- .../embedded_repack.rs} | 12 +- .../filter_tracks.rs} | 8 +- .../{write_filters.rs => write/filters.rs} | 8 +- .../fragment_child.rs} | 20 +- .../cut.rs => write/geometry/cut/mod.rs} | 5 +- .../geometry/cut/palette_tests.rs} | 0 .../{write_geometry => write/geometry}/mod.rs | 14 +- .../geometry/per_geometry/build_tests.rs} | 0 .../geometry/per_geometry/mod.rs} | 1 - .../geometry}/posed.rs | 8 +- .../geometry}/reference.rs | 0 .../geometry}/reference_cells.rs | 0 .../geometry}/skin.rs | 0 .../geometry_replace.rs} | 8 +- .../{write_material.rs => write/material.rs} | 10 +- .../headerless/{write.rs => write/mod.rs} | 76 +++- .../{write_navmesh.rs => write/navmesh.rs} | 6 +- .../navmesh_delete.rs} | 10 +- .../navmesh_links.rs} | 4 +- .../navmesh_side.rs} | 2 +- .../{write_palette.rs => write/palette.rs} | 14 +- .../{write_physics.rs => write/physics.rs} | 12 +- .../{write_skeleton.rs => write/skeleton.rs} | 6 +- .../{write_volume.rs => write/volume.rs} | 10 +- .../src/gta6/{map_author.rs => map/author.rs} | 0 .../src/gta6/{map_grow.rs => map/grow/mod.rs} | 1 - .../grow/orphans.rs} | 0 .../index_types/mod.rs} | 1 - .../index_types/tests.rs} | 0 .../{map_interior.rs => map/interior/mod.rs} | 1 - .../interior/tests.rs} | 0 .../gta6/{map_lanes.rs => map/lanes/mod.rs} | 1 - .../lanes/tests.rs} | 0 .../light_ext/mod.rs} | 1 - .../light_ext/tests.rs} | 0 .../gta6/{map_lights.rs => map/lights/mod.rs} | 1 - .../lights/tests.rs} | 0 .../lights_index.rs} | 0 .../{map_lights_lod.rs => map/lights_lod.rs} | 0 .../gta6/{map_links.rs => map/links/mod.rs} | 1 - .../links/tests.rs} | 0 .../io/or-io/src/gta6/{map.rs => map/mod.rs} | 14 - .../occluders/mod.rs} | 1 - .../occluders/tests.rs} | 0 .../{map_grass.rs => map/stream/grass/mod.rs} | 2 - .../stream/grass/slod/mod.rs} | 1 - .../stream/grass/slod/tests.rs} | 0 .../stream/grass/tests.rs} | 0 .../gta6/{map_stream.rs => map/stream/mod.rs} | 2 - .../stream/tests.rs} | 0 .../src/gta6/{map_tests.rs => map/tests.rs} | 0 .../gta6/{map_world.rs => map/world/mod.rs} | 1 - .../world/tests.rs} | 0 .../src/gta6/{map_grid.rs => map_grid/mod.rs} | 1 - .../{map_grid_tests.rs => map_grid/tests.rs} | 0 .../mod.rs} | 1 - .../tests.rs} | 0 .../mod.rs} | 1 - .../tests.rs} | 0 crates/io/or-io/src/gta6/mod.rs | 15 +- .../{move_network.rs => move_network/mod.rs} | 1 - .../tests.rs} | 0 .../or-io/src/gta6/{names.rs => names/mod.rs} | 1 - .../gta6/{names_tests.rs => names/tests.rs} | 0 .../edup_tests.rs} | 0 .../{other_bodies.rs => other_bodies/mod.rs} | 2 - .../tests.rs} | 0 .../gta6/{ped_assets.rs => ped_assets/mod.rs} | 1 - .../tests.rs} | 0 .../mod.rs} | 1 - .../tests.rs} | 0 .../gta6/{save_codec.rs => save/codec/mod.rs} | 1 - .../codec/tests.rs} | 0 .../{save_crypto.rs => save/crypto/mod.rs} | 1 - .../crypto/tests.rs} | 0 .../or-io/src/gta6/{save.rs => save/mod.rs} | 6 +- .../gta6/{save_stats.rs => save/stats/mod.rs} | 1 - .../stats/tests.rs} | 0 .../gta6/{save_story.rs => save/story/mod.rs} | 3 +- .../story/tests.rs} | 0 .../src/gta6/{save_tests.rs => save/tests.rs} | 0 .../src/gta6/script/{cfg.rs => cfg/mod.rs} | 1 - .../script/{cfg_tests.rs => cfg/tests.rs} | 0 .../disasm/asm/mod.rs} | 1 - .../disasm/asm/tests.rs} | 0 .../{disasm.rs => compiled/disasm/mod.rs} | 2 - .../disasm/tests.rs} | 0 .../edit/mod.rs} | 1 - .../edit/tests.rs} | 0 .../script/{compiled.rs => compiled/mod.rs} | 2 - .../gta6/script/{decode.rs => decode/mod.rs} | 2 - .../{decode_steps.rs => decode/steps.rs} | 0 .../{decode_tests.rs => decode/tests.rs} | 0 .../script/{emit_access.rs => emit/access.rs} | 0 .../src/gta6/script/{emit.rs => emit/mod.rs} | 2 - .../script/{emit_tests.rs => emit/tests.rs} | 0 .../corpus/members.rs} | 0 .../corpus/mod.rs} | 2 - .../corpus/written.rs} | 0 .../{exec_inputs_tests.rs => exec/inputs.rs} | 0 .../script/{exec_tests.rs => exec/mod.rs} | 3 - .../{exec_proofs_tests.rs => exec/proofs.rs} | 0 .../src/gta6/script/{ir.rs => ir/mod.rs} | 1 - .../gta6/script/{ir_tests.rs => ir/tests.rs} | 0 .../src/gta6/script/{lift.rs => lift/mod.rs} | 2 - .../script/{lift_sized.rs => lift/sizing.rs} | 0 .../script/{lift_tests.rs => lift/tests.rs} | 0 .../script/{listing.rs => listing/mod.rs} | 1 - .../{listing_tests.rs => listing/tests.rs} | 0 crates/io/or-io/src/gta6/script/mod.rs | 3 - .../{names_likely.rs => names/likely/mod.rs} | 1 - .../likely/tests.rs} | 0 .../gta6/script/{names.rs => names/mod.rs} | 6 - .../natives/mod.rs} | 1 - .../natives/tests.rs} | 0 .../{names_search.rs => names/search/mod.rs} | 1 - .../search/tests.rs} | 0 .../{names_slots.rs => names/slots/mod.rs} | 1 - .../slots/tests.rs} | 0 .../script/{names_tests.rs => names/tests.rs} | 0 .../{names_words.rs => names/words/mod.rs} | 1 - .../script/{ => names/words}/names_words.txt | 0 .../words/tests.rs} | 0 .../mod.rs} | 1 - .../tests.rs} | 0 .../gta6/script/{opcode.rs => opcode/mod.rs} | 2 - .../{opcode_table.rs => opcode/table.rs} | 0 .../{opcode_tests.rs => opcode/tests.rs} | 0 .../script/{options.rs => options/mod.rs} | 1 - .../{options_tests.rs => options/tests.rs} | 0 .../kinds/mod.rs} | 1 - .../kinds/tests.rs} | 0 .../{aggregates.rs => aggregates/mod.rs} | 2 - .../tests.rs} | 0 .../assigned/mod.rs} | 1 - .../assigned/tests.rs} | 0 .../calls/across.rs} | 0 .../calls/mod.rs} | 2 - .../calls/twin/mod.rs} | 1 - .../calls/twin/tests.rs} | 0 .../ends.rs} | 0 .../frame.rs} | 0 .../guard.rs} | 0 .../hoist.rs} | 0 .../iterated/mod.rs} | 1 - .../iterated/tests.rs} | 0 .../kick.rs} | 0 .../{async_await.rs => async_await/mod.rs} | 11 - .../place/mod.rs} | 1 - .../place/tests.rs} | 0 .../tests/calling.rs} | 0 .../tests/hide.rs} | 0 .../tests/hoisting.rs} | 0 .../tests/mod.rs} | 3 - .../yields/mod.rs} | 1 - .../yields/tests.rs} | 0 .../fields/mod.rs} | 1 - .../fields/tests.rs} | 0 .../frame/mod.rs} | 1 - .../frame/tests.rs} | 0 .../passes/{classes.rs => classes/mod.rs} | 5 - .../properties.rs} | 0 .../{classes_tests.rs => classes/tests.rs} | 0 .../typed/mod.rs} | 1 - .../typed/tests.rs} | 0 .../passes/{closures.rs => closures/mod.rs} | 1 - .../{closures_tests.rs => closures/tests.rs} | 0 .../passes/{coalesce.rs => coalesce/mod.rs} | 1 - .../{coalesce_tests.rs => coalesce/tests.rs} | 0 .../{default_last.rs => default_last/mod.rs} | 1 - .../tests.rs} | 0 .../passes/{fields.rs => fields/mod.rs} | 1 - .../{fields_tests.rs => fields/tests.rs} | 0 .../{forward_flow.rs => forward/flow.rs} | 0 .../passes/{forward.rs => forward/mod.rs} | 2 - .../{forward_tests.rs => forward/tests.rs} | 0 .../passes/{interproc.rs => interproc/mod.rs} | 1 - .../tests.rs} | 0 .../{names_across.rs => names/across/mod.rs} | 1 - .../across/tests.rs} | 0 .../script/passes/{names.rs => names/mod.rs} | 5 - .../{names_order.rs => names/order/mod.rs} | 1 - .../order/tests.rs} | 0 .../{names_shapes.rs => names/shapes/mod.rs} | 1 - .../shapes/tests.rs} | 0 .../{names_stated.rs => names/stated/mod.rs} | 1 - .../stated/tests.rs} | 0 .../passes/{names_tests.rs => names/tests.rs} | 0 .../cases.rs} | 0 .../cond/mod.rs} | 1 - .../cond/tests.rs} | 0 .../exits/mod.rs} | 1 - .../exits/tests.rs} | 0 .../graph.rs} | 0 .../inlined/mod.rs} | 1 - .../inlined/tests.rs} | 0 .../layout.rs} | 0 .../passes/{structure.rs => structure/mod.rs} | 9 - .../region.rs} | 0 .../tails/mod.rs} | 1 - .../tails/tests.rs} | 0 .../tests.rs} | 0 .../boxes/mod.rs} | 1 - .../boxes/tests.rs} | 0 .../mod.rs} | 3 - .../switch/mod.rs} | 1 - .../switch/tests.rs} | 0 .../tests/inside.rs} | 0 .../tests/mod.rs} | 1 - .../mod.rs} | 2 - .../table.rs} | 0 .../tests.rs} | 0 .../enumerators/mod.rs} | 1 - .../enumerators/tests.rs} | 0 .../guards/mod.rs} | 1 - .../guards/tests.rs} | 0 .../lists/mod.rs} | 1 - .../lists/tests.rs} | 0 .../mod.rs} | 4 - .../tests.rs} | 0 .../passes/{types_kinds.rs => types/kinds.rs} | 0 .../script/passes/{types.rs => types/mod.rs} | 3 - .../objects/mod.rs} | 1 - .../objects/tests.rs} | 0 .../passes/{types_tests.rs => types/tests.rs} | 0 .../{values_cells.rs => values/cells.rs} | 0 .../{values_effects.rs => values/effects.rs} | 0 .../fold/across/mod.rs} | 1 - .../fold/across/tests.rs} | 0 .../fold/chain/mod.rs} | 1 - .../fold/chain/tests.rs} | 0 .../{values_fold.rs => values/fold/mod.rs} | 4 - .../fold/objects/mod.rs} | 1 - .../fold/objects/tests.rs} | 0 .../fold/tests.rs} | 0 .../{values_joins.rs => values/joins.rs} | 0 .../locals/mod.rs} | 1 - .../locals/tests.rs} | 0 .../passes/{values.rs => values/mod.rs} | 6 - .../{values_tests.rs => values/tests.rs} | 0 .../{print_bare.rs => print/bare/mod.rs} | 1 - .../bare/tests.rs} | 0 .../constructs/mod.rs} | 1 - .../constructs/tests.rs} | 0 .../{print_csharp.rs => print/csharp/mod.rs} | 1 - .../csharp/tests.rs} | 0 .../{print_enums.rs => print/enums/mod.rs} | 1 - .../enums/tests.rs} | 0 .../{print_inlined.rs => print/inlined.rs} | 0 .../{print_async.rs => print/iterators.rs} | 0 .../lambda/jumps.rs} | 0 .../{print_lambda.rs => print/lambda/mod.rs} | 4 - .../lambda/tests.rs} | 0 .../lambda/through.rs} | 0 .../lambda/widths.rs} | 0 .../script/{print_lay.rs => print/lay/mod.rs} | 1 - .../lay/tests.rs} | 0 .../{print_legend.rs => print/legend.rs} | 0 .../{print_member.rs => print/members/mod.rs} | 1 - .../members/tests.rs} | 0 .../gta6/script/{print.rs => print/mod.rs} | 16 - .../natives/mod.rs} | 1 - .../natives/tests.rs} | 0 .../script/{print_old.rs => print/old.rs} | 0 .../prelude/mod.rs} | 1 - .../prelude/tests.rs} | 0 .../property/mod.rs} | 1 - .../property/tests.rs} | 0 .../{print_spell.rs => print/spell/mod.rs} | 1 - .../spell/tests.rs} | 0 .../script/{print_tests.rs => print/tests.rs} | 0 .../functions.rs} | 0 .../script/{program.rs => program/mod.rs} | 3 - .../{program_read.rs => program/read.rs} | 0 .../{program_tests.rs => program/tests.rs} | 0 .../script/project/{index.rs => index/mod.rs} | 1 - .../{index_tests.rs => index/tests.rs} | 0 .../{layouts_flows.rs => layouts/flows.rs} | 0 .../project/{layouts.rs => layouts/mod.rs} | 2 - .../{layouts_tests.rs => layouts/tests.rs} | 0 .../io/or-io/src/gta6/script/project/mod.rs | 1 - .../{outside_async.rs => outside/asyncs.rs} | 0 .../project/{outside.rs => outside/mod.rs} | 2 - .../{outside_tests.rs => outside/tests.rs} | 0 .../script/project/{reach.rs => reach/mod.rs} | 1 - .../{reach_tests.rs => reach/tests.rs} | 0 .../arguments/mod.rs} | 1 - .../arguments/tests.rs} | 0 .../{signatures.rs => signatures/mod.rs} | 4 - .../shared.rs} | 0 .../sites.rs} | 0 .../tests.rs} | 0 .../project/{project_tests.rs => tests.rs} | 0 .../script/project/{types.rs => types/mod.rs} | 1 - .../{types_tests.rs => types/tests.rs} | 0 .../{reparse_bare.rs => reparse/bare.rs} | 0 .../{reparse_enums.rs => reparse/enums.rs} | 0 .../{reparse_file.rs => reparse/file/mod.rs} | 1 - .../file/tests.rs} | 0 .../inlined.rs} | 0 .../members.rs} | 0 .../script/{reparse.rs => reparse/mod.rs} | 7 - .../property.rs} | 0 .../tests/mod.rs} | 1 - .../tests/source.rs} | 0 .../script/{sample_tests.rs => sample.rs} | 0 .../gta6/script/{mod_tests.rs => tests.rs} | 0 .../src/gta6/script/{tree.rs => tree/mod.rs} | 1 - .../script/{tree_tests.rs => tree/tests.rs} | 0 .../mod.rs} | 1 - .../tests.rs} | 0 .../{terrain_tile.rs => terrain_tile/mod.rs} | 1 - .../tests.rs} | 0 .../gta6/{text_edit.rs => text/edit/mod.rs} | 1 - .../edit/tests.rs} | 0 .../or-io/src/gta6/{text.rs => text/mod.rs} | 2 - .../src/gta6/{text_tests.rs => text/tests.rs} | 0 .../mod.rs} | 1 - .../tests.rs} | 0 .../gta6/{timecycle.rs => timecycle/mod.rs} | 1 - .../tests.rs} | 0 .../{ttpf_calibrate.rs => ttpf/calibrate.rs} | 0 .../or-io/src/gta6/{ttpf.rs => ttpf/mod.rs} | 3 - .../tests/author.rs} | 0 .../tests/calibrated.rs} | 0 .../tests/coder.rs} | 0 .../tests/envelope.rs} | 0 .../gta6/{ttpf_tests.rs => ttpf/tests/mod.rs} | 8 - .../tests/relayout/mod.rs} | 2 - .../tests/relayout/slices.rs} | 0 .../tests/relayout/volume.rs} | 0 .../tests/slice_replace.rs} | 0 .../tests/volumes.rs} | 0 .../tests/write.rs} | 0 .../gta6/{ttpf_write.rs => ttpf/write/mod.rs} | 3 - .../{ttpf_recode.rs => ttpf/write/recode.rs} | 0 .../write/relayout/mod.rs} | 2 - .../write/relayout/slices.rs} | 0 .../write/relayout/volume.rs} | 0 .../{ttpf_slice.rs => ttpf/write/slice.rs} | 0 .../src/gta6/{ui_tree.rs => ui_tree/mod.rs} | 1 - .../{ui_tree_tests.rs => ui_tree/tests.rs} | 0 .../src/gta6/{water_fog.rs => water/fog.rs} | 0 .../{water_height.rs => water/height/mod.rs} | 1 - .../height/tests.rs} | 0 .../or-io/src/gta6/{water.rs => water/mod.rs} | 4 - .../gta6/{water_tests.rs => water/tests.rs} | 0 .../gta6/{water_waves.rs => water/waves.rs} | 0 .../src/gta6/{weather.rs => weather/mod.rs} | 1 - .../{weather_tests.rs => weather/tests.rs} | 0 .../{world_state.rs => world_state/mod.rs} | 1 - .../tests.rs} | 0 .../src/gta6/{hashes.rs => hashes/mod.rs} | 1 - .../gta6/{hashes_tests.rs => hashes/tests.rs} | 0 .../import/{geometry.rs => geometry/mod.rs} | 1 - .../{geometry_tests.rs => geometry/tests.rs} | 0 .../names_mine/{named.rs => named/mod.rs} | 1 - .../{named_tests.rs => named/tests.rs} | 0 crates/tools/xtask/src/slow_tier.rs | 2 +- docs/direction/GTA_VI_Platforms_Plan.md | 6 +- docs/direction/Project_Context.md | 2 +- docs/direction/Roadmap.md | 178 ++++---- docs/direction/Shaded_World_Plan.md | 4 +- docs/direction/Unified_World_Plan.md | 34 +- docs/direction/Workbench_Plan.md | 4 +- docs/direction/Workbench_UX_Design.md | 2 +- docs/direction/World_Editor_Parity.md | 4 +- docs/direction/World_Editor_Plan.md | 8 +- docs/direction/World_Editor_UX_Design.md | 2 +- docs/features/Animation_Preview.md | 8 +- docs/features/GTA_VI_Builds.md | 90 ++-- docs/features/GTA_VI_Mods.md | 2 +- docs/features/GTA_VI_World_Viewer.md | 6 +- docs/guides/Development_Workflow.md | 2 +- docs/guides/Documentation_Standard.md | 2 +- docs/guides/Licence_And_Provenance_Policy.md | 4 +- docs/reference/Crate_Reference.md | 68 +-- plugins/README.md | 4 +- src/repo_tests/doc_citations.rs | 2 +- src/repo_tests/doc_counts/figures.rs | 5 - .../build/mod.rs} | 1 - .../build/tests.rs} | 0 .../jobs.rs} | 0 .../lists.rs} | 0 .../{gta6_script.rs => gta6_script/mod.rs} | 4 - .../tests.rs} | 0 .../a_document_that_will_not_save.rs | 0 src/state/document/{meta.rs => meta/mod.rs} | 1 - src/state/{file_io.rs => file_io/mod.rs} | 1 - src/state/{ => file_io}/save_source.rs | 0 src/state/files_view/mod.rs | 1 - .../{ => files_view}/rpf9_tree_row_kind.rs | 0 .../anim/gta6_anim_edit/mod.rs} | 25 +- .../anim/gta6_anim_edit/tests.rs} | 0 .../anim}/gta6_anim_in_audio_save.rs | 13 +- src/state/{ => gta6/anim}/gta6_anim_keys.rs | 4 +- src/state/{ => gta6/anim}/gta6_anim_play.rs | 8 +- .../anim/gta6_bone_edit/mod.rs} | 33 +- .../anim/gta6_bone_edit/tests.rs} | 0 .../{ => gta6/anim}/gta6_clip_finding.rs | 16 +- .../{ => gta6/anim}/gta6_entry_skeletons.rs | 12 +- .../{ => gta6/anim}/gta6_expression_edit.rs | 10 +- .../anim/gta6_face/mod.rs} | 17 +- .../anim/gta6_face/tests.rs} | 0 src/state/{ => gta6/anim}/gta6_filter_edit.rs | 15 +- .../{ => gta6/anim}/gta6_filter_entries.rs | 14 +- .../anim/gta6_set_finding/mod.rs} | 17 +- .../anim/gta6_set_finding/tests.rs} | 2 +- src/state/gta6/anim/mod.rs | 12 + .../audio/gta6_audio_links/mod.rs} | 13 +- .../audio/gta6_audio_links/tests.rs} | 4 +- .../audio/gta6_dialogue/mod.rs} | 22 +- .../audio/gta6_dialogue/tests.rs} | 0 src/state/{ => gta6/audio}/gta6_text.rs | 8 +- src/state/gta6/audio/mod.rs | 3 + .../bodies/gta6_meta_save/mod.rs} | 25 +- .../bodies/gta6_meta_save/splice.rs} | 0 .../bodies/gta6_other_bodies/mod.rs} | 23 +- .../bodies/gta6_other_bodies/nodes.rs} | 0 .../bodies/gta6_other_bodies_save/cell.rs} | 0 .../bodies/gta6_other_bodies_save/mod.rs} | 11 +- src/state/{ => gta6/bodies}/gta6_resource.rs | 67 +-- .../gta6_resource_save/awc_in_extent.rs} | 0 .../bodies/gta6_resource_save/mod.rs} | 75 +-- .../saving_an_edited_gta_vi_text_body.rs | 0 .../bodies/gta6_save/mod.rs} | 8 +- .../bodies/gta6_save/players.rs} | 0 .../bodies/gta6_save/story_tests.rs} | 0 src/state/gta6/bodies/mod.rs | 6 + .../drawable}/gta6_constant_types.rs | 6 +- .../drawable/gta6_edit/mod.rs} | 63 +-- .../drawable/gta6_edit/tests.rs} | 2 +- .../{ => gta6/drawable}/gta6_effect_facts.rs | 9 +- src/state/{ => gta6/drawable}/gta6_effects.rs | 38 +- src/state/{ => gta6/drawable}/gta6_export.rs | 22 +- .../{ => gta6/drawable}/gta6_fragment.rs | 8 +- .../drawable}/gta6_fragment_records.rs | 2 +- .../drawable/gta6_gltf_import/mod.rs} | 37 +- .../drawable/gta6_gltf_import/tests.rs} | 2 +- src/state/{ => gta6/drawable}/gta6_head.rs | 18 +- .../drawable/gta6_material_declared/mod.rs} | 1 - .../drawable/gta6_material_declared/tests.rs} | 0 .../drawable/gta6_material_layout/mod.rs} | 7 +- .../drawable/gta6_material_layout/tests.rs} | 0 src/state/{ => gta6/drawable}/gta6_morph.rs | 2 +- .../{ => gta6/drawable}/gta6_selected.rs | 16 +- .../drawable/gta6_shaders/forward_passes.rs} | 0 .../drawable/gta6_shaders/global_textures.rs} | 0 .../drawable/gta6_shaders/layer_index.rs} | 0 .../drawable/gta6_shaders/mod.rs} | 33 +- .../drawable/gta6_shaders/ped_assets/mod.rs} | 1 - .../gta6_shaders/ped_assets/skin_tones.rs} | 0 .../drawable/gta6_shaders/terrain_tile.rs} | 0 .../drawable/gta6_shaders/tests.rs} | 0 .../drawable/gta6_shaders/timecycle.rs} | 0 .../drawable/gta6_shaders/translator.rs} | 0 .../{ => gta6/drawable}/gta6_summaries.rs | 14 +- .../{ => gta6/drawable}/gta6_weapon_parts.rs | 8 +- src/state/gta6/drawable/mod.rs | 16 + .../{ => gta6/install}/gta6_first_entry.rs | 18 +- .../install}/gta6_install_harvest.rs | 40 +- .../{ => gta6/install}/gta6_install_scan.rs | 17 +- .../{ => gta6/install}/gta6_key_words.rs | 12 +- .../{ => gta6/install}/gta6_learned_names.rs | 0 .../{ => gta6/install}/gta6_name_pool.rs | 13 +- src/state/{ => gta6/install}/gta6_names.rs | 26 +- .../{ => gta6/install}/gta6_object_trees.rs | 4 +- src/state/{ => gta6/install}/gta6_small.rs | 8 +- src/state/{ => gta6/install}/gta_vi.rs | 26 +- src/state/gta6/install/mod.rs | 10 + src/state/gta6/mod.rs | 12 + .../modding}/anim_replace.rs | 0 .../modding}/audio_replace.rs | 0 .../modding}/batch_export.rs | 0 .../{gta6_modding => gta6/modding}/mod.rs | 0 .../modding/mod_package/mod.rs} | 1 - .../modding/mod_package/tests.rs} | 0 .../modding}/mod_package_changes.rs | 0 .../modding/mod_package_install/mod.rs} | 1 - .../modding/mod_package_install/tests.rs} | 0 .../modding/model_replace/mod.rs} | 3 +- .../modding/model_replace/tests.rs} | 0 .../modding}/motion_loop.rs | 0 .../modding}/references.rs | 0 .../modding/text_search/mod.rs} | 1 - .../modding/text_search/tests.rs} | 0 .../modding}/texture_replace.rs | 0 .../modding/typed_forms/handling.rs} | 0 .../modding/typed_forms/mod.rs} | 5 - .../modding/typed_forms/peds.rs} | 0 .../modding/typed_forms/population.rs} | 0 .../modding/typed_forms/tests.rs} | 0 .../modding/typed_forms/weapons.rs} | 0 .../particles}/gta6_particle_models.rs | 24 +- .../particles/gta6_particles/colour_max.rs} | 0 .../particles/gta6_particles/mod.rs} | 24 +- .../particles/gta6_particles/raw.rs} | 0 .../particles/gta6_particles/spawners.rs} | 0 .../particles/gta6_particles/sprites.rs} | 0 .../particles/gta6_particles/tests/colour.rs} | 0 .../particles/gta6_particles/tests/mod.rs} | 3 - .../particles/gta6_particles/tests/open.rs} | 0 .../particles/gta6_particles/tests/remove.rs} | 0 .../particles/gta6_particles_save/copies.rs} | 2 +- .../particles/gta6_particles_save/mod.rs} | 30 +- .../particles/gta6_particles_save/remove.rs} | 0 src/state/gta6/particles/mod.rs | 3 + src/state/{ => gta6/physics}/gta6_bound.rs | 6 +- .../{ => gta6/physics}/gta6_bound_vertex.rs | 4 +- .../physics/gta6_collision_edit/mod.rs} | 7 +- .../physics/gta6_collision_edit/tests.rs} | 0 src/state/{ => gta6/physics}/gta6_navmesh.rs | 30 +- .../physics/gta6_navmesh_delete/links.rs} | 0 .../physics/gta6_navmesh_delete/look.rs} | 0 .../physics/gta6_navmesh_delete/mod.rs} | 41 +- .../{ => gta6/physics}/gta6_navmesh_edit.rs | 24 +- .../gta6_physics_edit/bound_reshape.rs} | 0 .../physics/gta6_physics_edit/mod.rs} | 39 +- .../physics/gta6_physics_edit/tests.rs} | 0 src/state/gta6/physics/mod.rs | 7 + .../textures}/gta6_dictionary_index.rs | 35 +- .../textures/gta6_dictionary_write/mod.rs} | 29 +- .../textures/gta6_dictionary_write/tests.rs} | 0 .../textures/gta6_embedded_edit/mod.rs} | 43 +- .../textures/gta6_embedded_edit/tests.rs} | 6 +- .../{ => gta6/textures}/gta6_texture_index.rs | 57 +-- .../textures}/gta6_texture_names_file.rs | 6 +- .../textures}/gta6_texture_naming.rs | 20 +- .../{ => gta6/textures}/gta6_textures.rs | 94 ++-- src/state/gta6/textures/mod.rs | 7 + .../world/gta6_map/entity.rs} | 0 .../world/gta6_map/links/mod.rs} | 1 - .../world/gta6_map/links/tests.rs} | 0 .../world/gta6_map/mod.rs} | 43 +- .../world/gta6_map/tests.rs} | 2 +- .../world/gta6_map/types_edit.rs} | 0 .../world/gta6_map/world_delete.rs} | 0 src/state/{ => gta6/world}/gta6_map_edit.rs | 32 +- .../world/gta6_world/fill.rs} | 0 .../world/gta6_world/mod.rs} | 40 +- .../world/gta6_world/tests.rs} | 0 .../world/gta6_world/worldview/edit.rs} | 0 .../world/gta6_world/worldview/grass.rs} | 0 .../world/gta6_world/worldview}/index.rs | 0 .../world/gta6_world/worldview/keys.rs} | 0 .../world/gta6_world/worldview}/mod.rs | 7 - .../world/gta6_world/worldview/model/mod.rs} | 1 - .../gta6_world/worldview/model/tests.rs} | 0 .../world/gta6_world/worldview/pick.rs} | 0 .../gta6_world/worldview/reference/mod.rs} | 3 +- .../gta6_world/worldview/reference/parts.rs} | 0 .../world/gta6_world/worldview}/sky.rs | 0 .../gta6_world/worldview/stream_viewer.rs} | 0 .../gta6_world/worldview/texture/mod.rs} | 1 - .../gta6_world/worldview/texture/tests.rs} | 0 .../gta6_world/worldview/water/ground.rs} | 0 .../world/gta6_world/worldview/water/mod.rs} | 1 - .../world/gta6_world/worldview/whole.rs} | 0 src/state/{ => gta6/world}/gta6_world_edit.rs | 16 +- src/state/{ => gta6/world}/gta6_world_fits.rs | 9 +- src/state/gta6/world/mod.rs | 5 + src/state/mod.rs | 428 ++---------------- src/state/{prefs.rs => prefs/mod.rs} | 1 - src/state/{ => prefs}/prefs_ago.rs | 0 src/state/rpf/mod.rs | 14 + src/state/{ => rpf}/rpf9_counted_names.rs | 10 +- src/state/{ => rpf}/rpf9_kept.rs | 10 +- src/state/{ => rpf}/rpf9_list.rs | 2 +- .../rpf9_scan/ciphered}/gta6_script_view.rs | 0 .../rpf9_scan/ciphered/mod.rs} | 7 +- .../rpf9_scan}/extracting_a_gta_vi_body.rs | 0 .../{ => rpf/rpf9_scan}/gta6_data_xml.rs | 0 .../{rpf9_scan.rs => rpf/rpf9_scan/mod.rs} | 132 +++--- .../rpf9_scan/payload.rs} | 6 +- .../rpf9_table/gta6_archive_save/mod.rs} | 1 - .../rpf9_table/gta6_archive_save/tests.rs} | 0 .../rpf9_scan/rpf9_table}/gta6_keys_flow.rs | 0 .../rpf9_scan/rpf9_table}/gta6_keys_held.rs | 0 .../rpf9_scan/rpf9_table/mod.rs} | 4 - .../rpf9_scan/rpf9_table/names_cache.rs} | 0 .../{ => rpf/rpf9_scan}/rpf9_tree_actions.rs | 0 .../rpf9_scan/view.rs} | 0 .../rpf_archive_open/mod.rs} | 44 +- .../rpf_archive_open/tree_open/bind/mod.rs} | 1 - .../rpf_archive_open/tree_open/bind/tests.rs} | 0 .../rpf_archive_open/tree_open/mod.rs} | 2 - .../tree_open/names_tests.rs} | 0 .../tree_verbs/adopt/archive_size_tests.rs} | 0 .../rpf_archive_open/tree_verbs/adopt/mod.rs} | 2 - .../tree_verbs/adopt/tests.rs} | 0 .../tree_verbs/headerless_tests/mod.rs} | 1 - .../headerless_tests/saves_per_kind/edits.rs} | 0 .../headerless_tests/saves_per_kind/mod.rs} | 3 - .../saves_per_kind/read_back.rs} | 0 .../headerless_tests/saves_per_kind/rows.rs} | 0 .../rpf_archive_open/tree_verbs/mod.rs} | 4 - .../rpf_archive_open/tree_verbs/plan_job.rs} | 0 .../rpf_archive_open/tree_verbs/tests.rs} | 0 src/state/{ => rpf}/rpf_expansion.rs | 12 +- src/state/{ => rpf}/rpf_moves.rs | 22 +- src/state/{ => rpf}/rpf_node.rs | 6 +- src/state/{ => rpf}/rpf_records.rs | 12 +- src/state/{ => rpf}/rpf_session.rs | 16 +- src/state/{ => rpf}/rpf_tree.rs | 48 +- src/state/{ => rpf}/rpf_undo.rs | 34 +- src/state/{sinks/mod.rs => sinks.rs} | 0 ...the_pack_with_its_previous_kept_version.rs | 0 .../a_bones_numbers_can_be_edited.rs | 10 +- ..._on_disk_keeps_the_undo_steps_beside_it.rs | 6 +- .../a_drag_carries_every_selected_row.rs | 2 +- ...es_and_a_change_of_nothing_does_nothing.rs | 8 +- ..._shapes_the_data_is_not_edited_in_place.rs | 14 +- ...oth_is_linked_and_its_shop_ids_are_kept.rs | 6 +- .../a_gta_vi_archive_s_scan_is_kept.rs | 0 .../a_model_is_drawn_with_its_own_textures.rs | 8 +- ...leted_archive_row_leaves_nothing_behind.rs | 9 +- src/state/{ => tests}/a_new_project.rs | 4 +- ...e_preview_opens_its_document_at_its_row.rs | 2 +- ...pinned_inspector_shows_its_own_document.rs | 4 +- .../a_plugin_asks_before_it_runs.rs | 28 +- .../a_project_holds_only_sources.rs | 10 +- .../a_recook_reloads_what_is_open.rs | 8 +- ...isk_waits_for_the_extraction_reading_it.rs | 10 +- ...a_right_click_or_a_drag_selects_its_row.rs | 6 +- .../a_save_names_its_destination.rs | 29 +- .../a_self_check_keeps_to_itself.rs | 8 +- ...a_skeleton_is_seen_without_an_animation.rs | 8 +- .../a_wardrobe_edit_is_recoverable.rs | 6 +- src/state/{ => tests}/adding_a_format.rs | 6 +- .../adding_particle_files_is_an_import.rs | 4 +- .../adding_weapons_is_an_import.rs | 4 +- ...alt_click_in_the_viewport_picks_a_model.rs | 4 +- .../an_awc_animation_is_written_back.rs | 2 +- .../an_awc_stream_opens_its_animation.rs | 4 +- ..._edit_of_the_wardrobe_is_a_step_of_undo.rs | 8 +- .../an_edit_stays_where_it_was_made.rs | 27 +- .../{ => tests}/an_error_names_what_failed.rs | 4 +- ..._export_asks_before_it_alters_the_bytes.rs | 10 +- ...tion_holds_back_only_the_files_it_reads.rs | 12 +- ...at_says_what_was_done_and_takes_it_back.rs | 4 +- .../an_undo_finishes_or_says_why.rs | 4 +- src/state/{ => tests}/applying_a_preset.rs | 4 +- src/state/{ => tests}/authoring.rs | 0 .../building_a_dlc_pack_from_the_app.rs | 4 +- .../building_targets_from_the_app.rs | 4 +- .../comparing_every_resource_and_archive.rs | 36 +- src/state/{ => tests}/comparing_two_files.rs | 20 +- .../{ => tests}/converting_from_the_app.rs | 32 +- .../converting_in_a_modders_words.rs | 8 +- ...ng_is_listed_and_asked_inside_its_panel.rs | 8 +- .../{ => tests}/copy_cut_and_paste/fields.rs | 0 .../{ => tests}/copy_cut_and_paste/files.rs | 4 +- .../{ => tests}/copy_cut_and_paste/mod.rs | 12 +- .../{ => tests}/copy_cut_and_paste/records.rs | 0 .../{ => tests}/defragmenting_an_archive.rs | 21 +- .../destructive_file_operations_ask.rs | 12 +- src/state/{ => tests}/dropped_files.rs | 2 +- .../dropping_and_importing_folders.rs | 2 +- src/state/{ => tests}/editing_a_clip.rs | 2 +- .../{ => tests}/enhanced_controls_say_so.rs | 16 +- ...every_add_lands_where_the_tree_shows_it.rs | 4 +- src/state/{ => tests}/every_edit_undoes.rs | 8 +- .../every_question_fits_a_narrow_window.rs | 18 +- .../every_view_follows_every_edit.rs | 8 +- .../every_viewer_path_takes_both_targets.rs | 14 +- .../every_write_asks_the_jobs_reading_it.rs | 20 +- ...te_into_a_folder_a_job_reads_is_refused.rs | 6 +- ...x_all_safe_and_the_optimiser_in_the_app.rs | 6 +- .../gltf_in_and_out_from_the_app.rs | 14 +- src/state/{ => tests}/going_to_a_file.rs | 6 +- .../gta6_textures_resolve_and_save.rs | 10 +- .../importing_game_files_from_the_app.rs | 22 +- .../maps_and_a_budget_in_the_app.rs | 4 +- src/state/{tests.rs => tests/mod.rs} | 155 ++++++- .../nested_archives_survive_a_save.rs | 32 +- .../no_save_replaces_a_file_a_job_reads.rs | 30 +- .../nothing_draws_over_what_it_belongs_to.rs | 50 +- .../nothing_extracts_into_an_install.rs | 14 +- .../one_place_for_background_jobs.rs | 34 +- src/state/{ => tests}/opening_a_dds.rs | 11 +- src/state/{ => tests}/opening_a_gta_vi_awc.rs | 10 +- .../{ => tests}/opening_a_gta_vi_body.rs | 31 +- src/state/{ => tests}/opening_a_nametable.rs | 2 +- src/state/{ => tests}/opening_a_rel.rs | 2 +- src/state/{ => tests}/opening_a_ttpf.rs | 34 +- src/state/{ => tests}/opening_a_ydd.rs | 12 +- src/state/{ => tests}/opening_an_awc.rs | 12 +- .../{ => tests}/opening_an_rpf9_archive.rs | 38 +- .../{ => tests}/opening_an_unknown_file.rs | 6 +- .../opening_metadata_without_a_schema.rs | 2 +- src/state/{ => tests}/opening_world_dat.rs | 6 +- src/state/{ => tests}/opus_on_a_worker.rs | 4 +- src/state/{ => tests}/previewing_a_video.rs | 2 +- .../reopening_a_built_pack_from_the_app.rs | 8 +- .../reordering_mods_from_the_app.rs | 6 +- .../replacing_geometry_from_the_app.rs | 4 +- ...wice_and_into_an_archive_not_yet_opened.rs | 2 +- .../{ => tests}/search_results_that_open.rs | 10 +- ...settings_recents_and_small_editor_fixes.rs | 10 +- src/state/{ => tests}/shards.rs | 0 src/state/{ => tests}/sharing_a_project.rs | 8 +- ...lts_in_the_default_views_menus_and_keys.rs | 12 +- ...l_faults_in_the_editor_and_the_previews.rs | 2 +- .../tabs_that_behave_like_an_editors.rs | 8 +- src/state/{ => tests}/test_scratch.rs | 6 +- .../{ => tests}/the_addon_ped_in_the_app.rs | 6 +- ...ion_preview_draws_what_its_sources_hold.rs | 18 +- ...e_animation_preview_follows_its_sources.rs | 4 +- .../the_default_views_in_a_modders_words.rs | 35 +- src/state/{ => tests}/the_dressed_ped.rs | 42 +- ...irst_person_view_and_the_floor_of_heels.rs | 4 +- .../the_dressed_ped_wears_props.rs | 0 .../the_edit_mode_is_visible_and_honest.rs | 6 +- .../the_files_view_in_the_centre/keys.rs | 0 .../the_files_view_in_the_centre/mod.rs | 43 +- src/state/{ => tests}/the_front_door.rs | 8 +- .../the_front_door_opens_and_closes.rs | 6 +- .../the_gate_in_front_of_every_write.rs | 88 ++-- ...nd_undo_survive_an_edit_of_the_contents.rs | 2 +- .../the_inspector_leads_with_a_summary.rs | 26 +- .../{ => tests}/the_lock_a_window_holds.rs | 2 +- .../the_map_screen_holds_a_session.rs | 22 +- .../the_map_screen_saves_with_the_project.rs | 10 +- .../{ => tests}/the_mesh_doctor_in_the_app.rs | 2 +- .../the_panel_counts_the_apps_cpu_state.rs | 4 +- ...els_around_the_viewer_take_both_targets.rs | 16 +- src/state/{ => tests}/the_project_history.rs | 22 +- ...ect_history_across_imports_and_projects.rs | 4 +- src/state/{ => tests}/the_project_polish.rs | 33 +- src/state/{ => tests}/the_project_screens.rs | 4 +- .../{ => tests}/the_project_workspace.rs | 14 +- ...d_its_problems_written_out_from_the_app.rs | 6 +- src/state/{ => tests}/the_shells_regions.rs | 2 +- ..._skeleton_files_own_model_can_be_hidden.rs | 4 +- ...e_two_paths_of_the_workbench_end_to_end.rs | 8 +- .../the_unsaved_marker_tells_the_truth.rs | 4 +- .../the_viewport_draws_every_edit.rs | 4 +- .../the_viewport_picks_every_line_it_draws.rs | 4 +- .../the_viewport_picks_what_it_draws.rs | 68 +-- .../the_wardrobe_edit_operations.rs | 2 +- .../the_wardrobe_import_breadth.rs | 2 +- .../{ => tests}/the_wardrobe_workspace.rs | 22 +- .../the_world_screen_adds_and_copies.rs | 8 +- .../the_world_screen_edits_a_project.rs | 35 +- .../the_world_screen_has_a_manipulator.rs | 16 +- .../the_world_screen_shows_layers.rs | 6 +- ...world_screen_takes_its_keys_as_commands.rs | 10 +- ...wo_readers_of_one_archive_across_a_save.rs | 15 +- ...the_sliders_follow_the_pinned_inspector.rs | 5 +- ...ndo_from_files_acts_on_what_files_shows.rs | 12 +- .../uses_and_used_by_in_the_app.rs | 66 +-- .../{ => tests}/uses_over_a_retail_install.rs | 0 .../{ => tests}/uses_reaches_every_pack.rs | 12 +- src/state/{ => tests}/viewing_never_edits.rs | 8 +- .../viewport_basics_for_inspecting_assets.rs | 25 +- .../what_a_comparison_still_missed.rs | 35 +- .../what_archive_rows_still_get_wrong.rs | 8 +- .../what_the_create_menu_offers.rs | 6 +- .../calibration.rs} | 0 .../mod.rs} | 2 - .../relaid.rs} | 0 src/state/vfs_session.rs | 6 +- .../workbench/{dressed.rs => dressed/mod.rs} | 0 src/state/workbench/{scan.rs => scan/mod.rs} | 0 .../{driven.rs => driven/mod.rs} | 0 940 files changed, 2864 insertions(+), 3152 deletions(-) rename crates/domain/or-world-gta6/src/day/{exposure.rs => exposure/mod.rs} (99%) rename crates/domain/or-world-gta6/src/day/{exposure_tests.rs => exposure/tests.rs} (100%) rename crates/domain/or-world-gta6/src/day/{frame.rs => frame/mod.rs} (99%) rename crates/domain/or-world-gta6/src/day/{frame_tests.rs => frame/tests.rs} (100%) rename crates/domain/or-world-gta6/src/day/{sky.rs => sky/mod.rs} (99%) rename crates/domain/or-world-gta6/src/day/{sky_tests.rs => sky/tests.rs} (100%) rename crates/domain/or-world-gta6/src/day/{sun.rs => sun/mod.rs} (99%) rename crates/domain/or-world-gta6/src/day/{sun_tests.rs => sun/tests.rs} (100%) rename crates/domain/or-world-gta6/src/day/{day_tests.rs => tests.rs} (100%) rename crates/domain/or-world-gta6/src/day/{vars.rs => vars/mod.rs} (99%) rename crates/domain/or-world-gta6/src/day/{vars_tests.rs => vars/tests.rs} (100%) rename crates/domain/or-world-gta6/src/day/{weather.rs => weather/mod.rs} (99%) rename crates/domain/or-world-gta6/src/day/{weather_tests.rs => weather/tests.rs} (100%) rename crates/domain/or-world-gta6/src/day/{wind.rs => wind/mod.rs} (99%) rename crates/domain/or-world-gta6/src/day/{wind_tests.rs => wind/tests.rs} (100%) rename crates/domain/or-world-gta6/src/{edit_entities_made_up.rs => edit/entities/made_up.rs} (100%) rename crates/domain/or-world-gta6/src/{edit_entities.rs => edit/entities/mod.rs} (99%) rename crates/domain/or-world-gta6/src/{edit_entities_tests.rs => edit/entities/tests.rs} (100%) rename crates/domain/or-world-gta6/src/{edit_extents.rs => edit/extents.rs} (100%) rename crates/domain/or-world-gta6/src/{edit.rs => edit/mod.rs} (98%) rename crates/domain/or-world-gta6/src/{edit_tests.rs => edit/tests.rs} (100%) rename crates/domain/or-world-gta6/src/{index_install.rs => index/install.rs} (100%) rename crates/domain/or-world-gta6/src/{index.rs => index/mod.rs} (99%) rename crates/domain/or-world-gta6/src/{index_mount.rs => index/mount/mod.rs} (99%) rename crates/domain/or-world-gta6/src/{index_mount_tests.rs => index/mount/tests.rs} (100%) rename crates/domain/or-world-gta6/src/{index_open.rs => index/open/mod.rs} (99%) rename crates/domain/or-world-gta6/src/{index_open_tests.rs => index/open/tests.rs} (100%) rename crates/domain/or-world-gta6/src/{index_rows.rs => index/rows.rs} (100%) rename crates/domain/or-world-gta6/src/{index_scan.rs => index/scan.rs} (100%) rename crates/domain/or-world-gta6/src/{index_scan_table.rs => index/scan_table/mod.rs} (99%) rename crates/domain/or-world-gta6/src/{index_scan_table_tests.rs => index/scan_table/tests.rs} (100%) rename crates/domain/or-world-gta6/src/{index_states.rs => index/states/mod.rs} (99%) rename crates/domain/or-world-gta6/src/{index_states_tests.rs => index/states/tests.rs} (100%) rename crates/domain/or-world-gta6/src/{stream_census.rs => stream/census.rs} (100%) rename crates/domain/or-world-gta6/src/{stream_grass.rs => stream/grass.rs} (100%) rename crates/domain/or-world-gta6/src/{stream_laid.rs => stream/laid.rs} (100%) rename crates/domain/or-world-gta6/src/{stream.rs => stream/mod.rs} (99%) rename crates/domain/or-world-gta6/src/{stream_pick.rs => stream/pick/mod.rs} (99%) rename crates/domain/or-world-gta6/src/{stream_pick_tests.rs => stream/pick/tests.rs} (100%) rename crates/domain/or-world-gta6/src/{stream_read.rs => stream/read.rs} (100%) rename crates/domain/or-world-gta6/src/{stream_slod.rs => stream/slod.rs} (100%) rename crates/domain/or-world-gta6/src/{stream_tests.rs => stream/tests.rs} (100%) rename crates/domain/or-world-gta6/src/{stream_world.rs => stream/world.rs} (100%) rename crates/io/or-io/src/gta6/accel/{build.rs => build/mod.rs} (99%) rename crates/io/or-io/src/gta6/accel/{build_tests.rs => build/tests.rs} (100%) rename crates/io/or-io/src/gta6/accel/{intersect.rs => intersect/mod.rs} (99%) rename crates/io/or-io/src/gta6/accel/{intersect_tests.rs => intersect/tests.rs} (100%) rename crates/io/or-io/src/gta6/accel/{query.rs => query/mod.rs} (99%) rename crates/io/or-io/src/gta6/accel/{query_tests.rs => query/tests.rs} (100%) rename crates/io/or-io/src/gta6/accel/{refit.rs => refit/mod.rs} (99%) rename crates/io/or-io/src/gta6/accel/{refit_tests.rs => refit/tests.rs} (100%) rename crates/io/or-io/src/gta6/accel/{select.rs => select/mod.rs} (99%) rename crates/io/or-io/src/gta6/accel/{select_tests.rs => select/tests.rs} (100%) rename crates/io/or-io/src/gta6/accel/{walk.rs => walk/mod.rs} (99%) rename crates/io/or-io/src/gta6/accel/{walk_tests.rs => walk/tests.rs} (100%) rename crates/io/or-io/src/gta6/accel/{ => walk}/wave_tests.rs (100%) rename crates/io/or-io/src/gta6/anim/{columns.rs => columns/mod.rs} (99%) rename crates/io/or-io/src/gta6/anim/{columns_tests.rs => columns/tests.rs} (100%) rename crates/io/or-io/src/gta6/anim/{databases.rs => databases/mod.rs} (99%) rename crates/io/or-io/src/gta6/anim/{databases_tests.rs => databases/tests.rs} (100%) rename crates/io/or-io/src/gta6/anim/{expressions.rs => expressions/mod.rs} (99%) rename crates/io/or-io/src/gta6/anim/{expressions_tests.rs => expressions/tests.rs} (100%) rename crates/io/or-io/src/gta6/anim/{expressions_group_d.rs => expressions_layout/group_d/mod.rs} (99%) rename crates/io/or-io/src/gta6/anim/{expressions_group_d_tests.rs => expressions_layout/group_d/tests.rs} (100%) rename crates/io/or-io/src/gta6/anim/{expressions_layout.rs => expressions_layout/mod.rs} (99%) rename crates/io/or-io/src/gta6/anim/{expressions_shape_tests.rs => expressions_layout/shape_tests.rs} (100%) rename crates/io/or-io/src/gta6/anim/{expressions_layout_tests.rs => expressions_layout/tests.rs} (100%) rename crates/io/or-io/src/gta6/anim/{matcher_levels.rs => matcher/levels.rs} (100%) rename crates/io/or-io/src/gta6/anim/{matcher.rs => matcher/mod.rs} (99%) rename crates/io/or-io/src/gta6/anim/{matcher_tests.rs => matcher/tests.rs} (100%) rename crates/io/or-io/src/gta6/anim/{metadata.rs => metadata/mod.rs} (99%) rename crates/io/or-io/src/gta6/anim/{metadata_tests.rs => metadata/tests.rs} (100%) rename crates/io/or-io/src/gta6/anim/{clip_signature_tests.rs => tests/clip_signature.rs} (100%) rename crates/io/or-io/src/gta6/anim/{clip_signature_build_tests.rs => tests/clip_signature_build/mod.rs} (99%) rename crates/io/or-io/src/gta6/anim/{replace_build_tests.rs => tests/clip_signature_build/replace.rs} (100%) rename crates/io/or-io/src/gta6/anim/{anim_tests.rs => tests/mod.rs} (98%) rename crates/io/or-io/src/gta6/anim/{motion_loop_tests.rs => tests/motion_loop/mod.rs} (97%) rename crates/io/or-io/src/gta6/anim/{motion_loop_build_tests.rs => tests/motion_loop/on_the_build.rs} (100%) rename crates/io/or-io/src/gta6/anim/{write_tests.rs => tests/write.rs} (100%) rename crates/io/or-io/src/gta6/anim/{write_derived_and_grown_tests.rs => tests/write_derived_and_grown.rs} (100%) rename crates/io/or-io/src/gta6/anim/{write_edit_tests.rs => tests/write_edit.rs} (100%) rename crates/io/or-io/src/gta6/anim/{write_in_extent_tests.rs => tests/write_in_extent.rs} (100%) rename crates/io/or-io/src/gta6/anim/{write_mapped_tests.rs => tests/write_mapped.rs} (100%) rename crates/io/or-io/src/gta6/anim/{write_relayout_tests.rs => tests/write_relayout.rs} (100%) rename crates/io/or-io/src/gta6/anim/{write_replace_tests.rs => tests/write_replace.rs} (100%) rename crates/io/or-io/src/gta6/anim/{write.rs => write/mod.rs} (100%) rename crates/io/or-io/src/gta6/{anim_scene.rs => anim_scene/mod.rs} (99%) rename crates/io/or-io/src/gta6/{anim_scene_tests.rs => anim_scene/tests.rs} (100%) rename crates/io/or-io/src/gta6/{audio_data.rs => audio/data/mod.rs} (99%) rename crates/io/or-io/src/gta6/{audio_data_tests.rs => audio/data/tests.rs} (100%) rename crates/io/or-io/src/gta6/{ => audio/links}/audio_layouts.txt (100%) rename crates/io/or-io/src/gta6/{ => audio/links}/audio_value_types.txt (100%) rename crates/io/or-io/src/gta6/{audio_links.rs => audio/links/mod.rs} (98%) rename crates/io/or-io/src/gta6/{audio_tables.rs => audio/links/tables.rs} (99%) rename crates/io/or-io/src/gta6/{audio_links_tests.rs => audio/links/tests.rs} (100%) create mode 100644 crates/io/or-io/src/gta6/audio/mod.rs rename crates/io/or-io/src/gta6/{audio_radio.rs => audio/radio/mod.rs} (99%) rename crates/io/or-io/src/gta6/{audio_radio_tests.rs => audio/radio/tests.rs} (100%) rename crates/io/or-io/src/gta6/bcpack/{bc6h.rs => bc6h/mod.rs} (99%) rename crates/io/or-io/src/gta6/bcpack/{bc6h_tests.rs => bc6h/tests.rs} (100%) rename crates/io/or-io/src/gta6/bcpack/{bptc.rs => bptc/mod.rs} (99%) rename crates/io/or-io/src/gta6/bcpack/{bptc_tests.rs => bptc/tests.rs} (100%) rename crates/io/or-io/src/gta6/bcpack/{ => calibrate}/bc6h_fit.rs (100%) rename crates/io/or-io/src/gta6/bcpack/{ => calibrate}/bptc_fit.rs (100%) rename crates/io/or-io/src/gta6/bcpack/{calibrate.rs => calibrate/mod.rs} (99%) rename crates/io/or-io/src/gta6/bcpack/{calibrate_tests.rs => calibrate/tests.rs} (100%) rename crates/io/or-io/src/gta6/bcpack/{encode_rans.rs => encode/entropy.rs} (100%) rename crates/io/or-io/src/gta6/bcpack/{encode.rs => encode/mod.rs} (97%) rename crates/io/or-io/src/gta6/bcpack/{encode_bc1.rs => encode/of_bc1.rs} (100%) rename crates/io/or-io/src/gta6/bcpack/{encode_bc6h.rs => encode/of_bc6h.rs} (100%) rename crates/io/or-io/src/gta6/bcpack/{encode_bc7.rs => encode/of_bc7.rs} (100%) rename crates/io/or-io/src/gta6/bcpack/{encode_tests.rs => encode/tests.rs} (100%) rename crates/io/or-io/src/gta6/bcpack/{supplied.rs => supplied/mod.rs} (99%) rename crates/io/or-io/src/gta6/bcpack/{supplied_tests.rs => supplied/tests.rs} (100%) rename crates/io/or-io/src/gta6/{dialogue.rs => dialogue/mod.rs} (99%) rename crates/io/or-io/src/gta6/{dialogue_tests.rs => dialogue/tests.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{forest.rs => forest/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/{forest_tests.rs => forest/tests.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{fragment_records.rs => fragment_records/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/{fragment_records_tests.rs => fragment_records/tests.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_bits.rs => particles/bits.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_colour.rs => particles/colour_word.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_copy.rs => particles/copier.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_event_object.rs => particles/dup/event_object.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_dup.rs => particles/dup/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/{particles_fields.rs => particles/fields_word.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_gpu.rs => particles/gpu.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_keys.rs => particles/keys.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles.rs => particles/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/{particles_open.rs => particles/parts.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_remove.rs => particles/remover.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_tables.rs => particles/tables.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_copy_tests.rs => particles/tests/copied.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_event_object_tests.rs => particles/tests/duplicated/event_object.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_dup_tests.rs => particles/tests/duplicated/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/{particles_keys_tests.rs => particles/tests/keys_added.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_tests.rs => particles/tests/mod.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{particles_open_tests.rs => particles/tests/open.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_remove_tests.rs => particles/tests/remove.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{particles_write.rs => particles/writer.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{small.rs => small/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/{small_tests.rs => small/tests.rs} (100%) rename crates/io/or-io/src/gta6/headerless/tests/{bound.rs => bound/mod.rs} (98%) rename crates/io/or-io/src/gta6/headerless/tests/{write_bound_grow.rs => bound/write_bound_grow/mod.rs} (98%) rename crates/io/or-io/src/gta6/headerless/tests/{ => bound/write_bound_grow}/write_bound_plain_copy.rs (100%) rename crates/io/or-io/src/gta6/headerless/tests/{ => bound/write_bound_grow}/write_bound_runs.rs (98%) rename crates/io/or-io/src/gta6/headerless/tests/{ => bound}/write_bound_reshape.rs (100%) rename crates/io/or-io/src/gta6/headerless/tests/{ => bound}/write_bound_vertex.rs (100%) rename crates/io/or-io/src/gta6/headerless/tests/{fragment.rs => fragment/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/tests/{ => fragment}/write_fragment_child.rs (100%) rename crates/io/or-io/src/gta6/headerless/tests/{navmesh.rs => navmesh/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/tests/{ => navmesh}/write_navmesh.rs (100%) rename crates/io/or-io/src/gta6/headerless/tests/{write_navmesh_delete.rs => navmesh/write_navmesh_delete/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/tests/{ => navmesh/write_navmesh_delete}/write_navmesh_links.rs (100%) rename crates/io/or-io/src/gta6/headerless/tests/{ => navmesh/write_navmesh_delete}/write_navmesh_no_cell.rs (100%) rename crates/io/or-io/src/gta6/headerless/{write_bone_names.rs => write/bone_names.rs} (95%) rename crates/io/or-io/src/gta6/headerless/{write_bound_grow.rs => write/bound_grow.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_bound_reshape.rs => write/bound_reshape.rs} (97%) rename crates/io/or-io/src/gta6/headerless/{write_bound_runs.rs => write/bound_runs.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_bound_values.rs => write/bound_values.rs} (96%) rename crates/io/or-io/src/gta6/headerless/{write_bound_vertex.rs => write/bound_vertex.rs} (97%) rename crates/io/or-io/src/gta6/headerless/{write_bvh.rs => write/bvh.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_dictionary.rs => write/dictionary/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/{write_dictionary_tests.rs => write/dictionary/tests.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{write_dictionary_entries.rs => write/dictionary_entries.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_dictionary_textures.rs => write/dictionary_textures/mod.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_dictionary_textures_tests.rs => write/dictionary_textures/tests.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{write_embedded.rs => write/embedded.rs} (94%) rename crates/io/or-io/src/gta6/headerless/{write_embedded_repack.rs => write/embedded_repack.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_filter_tracks.rs => write/filter_tracks.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_filters.rs => write/filters.rs} (95%) rename crates/io/or-io/src/gta6/headerless/{write_fragment_child.rs => write/fragment_child.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_geometry/cut.rs => write/geometry/cut/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/{write_geometry/cut_palette_tests.rs => write/geometry/cut/palette_tests.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{write_geometry => write/geometry}/mod.rs (99%) rename crates/io/or-io/src/gta6/headerless/{write_geometry/per_geometry_build_tests.rs => write/geometry/per_geometry/build_tests.rs} (100%) rename crates/io/or-io/src/gta6/headerless/{write_geometry/per_geometry.rs => write/geometry/per_geometry/mod.rs} (99%) rename crates/io/or-io/src/gta6/headerless/{write_geometry => write/geometry}/posed.rs (96%) rename crates/io/or-io/src/gta6/headerless/{write_geometry => write/geometry}/reference.rs (100%) rename crates/io/or-io/src/gta6/headerless/{write_geometry => write/geometry}/reference_cells.rs (100%) rename crates/io/or-io/src/gta6/headerless/{write_geometry => write/geometry}/skin.rs (100%) rename crates/io/or-io/src/gta6/headerless/{write_geometry_replace.rs => write/geometry_replace.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_material.rs => write/material.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write.rs => write/mod.rs} (77%) rename crates/io/or-io/src/gta6/headerless/{write_navmesh.rs => write/navmesh.rs} (96%) rename crates/io/or-io/src/gta6/headerless/{write_navmesh_delete.rs => write/navmesh_delete.rs} (99%) rename crates/io/or-io/src/gta6/headerless/{write_navmesh_links.rs => write/navmesh_links.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_navmesh_side.rs => write/navmesh_side.rs} (99%) rename crates/io/or-io/src/gta6/headerless/{write_palette.rs => write/palette.rs} (97%) rename crates/io/or-io/src/gta6/headerless/{write_physics.rs => write/physics.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_skeleton.rs => write/skeleton.rs} (98%) rename crates/io/or-io/src/gta6/headerless/{write_volume.rs => write/volume.rs} (93%) rename crates/io/or-io/src/gta6/{map_author.rs => map/author.rs} (100%) rename crates/io/or-io/src/gta6/{map_grow.rs => map/grow/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_grow_orphans.rs => map/grow/orphans.rs} (100%) rename crates/io/or-io/src/gta6/{map_index_types.rs => map/index_types/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_index_types_tests.rs => map/index_types/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map_interior.rs => map/interior/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_interior_tests.rs => map/interior/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map_lanes.rs => map/lanes/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_lanes_tests.rs => map/lanes/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map_light_ext.rs => map/light_ext/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_light_ext_tests.rs => map/light_ext/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map_lights.rs => map/lights/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_lights_tests.rs => map/lights/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map_lights_index.rs => map/lights_index.rs} (100%) rename crates/io/or-io/src/gta6/{map_lights_lod.rs => map/lights_lod.rs} (100%) rename crates/io/or-io/src/gta6/{map_links.rs => map/links/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_links_tests.rs => map/links/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map.rs => map/mod.rs} (98%) rename crates/io/or-io/src/gta6/{map_occluders.rs => map/occluders/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_occluders_tests.rs => map/occluders/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map_grass.rs => map/stream/grass/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_slod.rs => map/stream/grass/slod/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_slod_tests.rs => map/stream/grass/slod/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map_grass_tests.rs => map/stream/grass/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map_stream.rs => map/stream/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_stream_tests.rs => map/stream/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map_tests.rs => map/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map_world.rs => map/world/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_world_tests.rs => map/world/tests.rs} (100%) rename crates/io/or-io/src/gta6/{map_grid.rs => map_grid/mod.rs} (99%) rename crates/io/or-io/src/gta6/{map_grid_tests.rs => map_grid/tests.rs} (100%) rename crates/io/or-io/src/gta6/{mission_other.rs => mission_other/mod.rs} (99%) rename crates/io/or-io/src/gta6/{mission_other_tests.rs => mission_other/tests.rs} (100%) rename crates/io/or-io/src/gta6/{mission_tables.rs => mission_tables/mod.rs} (99%) rename crates/io/or-io/src/gta6/{mission_tables_tests.rs => mission_tables/tests.rs} (100%) rename crates/io/or-io/src/gta6/{move_network.rs => move_network/mod.rs} (99%) rename crates/io/or-io/src/gta6/{move_network_tests.rs => move_network/tests.rs} (100%) rename crates/io/or-io/src/gta6/{names.rs => names/mod.rs} (99%) rename crates/io/or-io/src/gta6/{names_tests.rs => names/tests.rs} (100%) rename crates/io/or-io/src/gta6/{other_bodies_edup_tests.rs => other_bodies/edup_tests.rs} (100%) rename crates/io/or-io/src/gta6/{other_bodies.rs => other_bodies/mod.rs} (99%) rename crates/io/or-io/src/gta6/{other_bodies_tests.rs => other_bodies/tests.rs} (100%) rename crates/io/or-io/src/gta6/{ped_assets.rs => ped_assets/mod.rs} (99%) rename crates/io/or-io/src/gta6/{ped_assets_tests.rs => ped_assets/tests.rs} (100%) rename crates/io/or-io/src/gta6/{ped_catalogue.rs => ped_catalogue/mod.rs} (99%) rename crates/io/or-io/src/gta6/{ped_catalogue_tests.rs => ped_catalogue/tests.rs} (100%) rename crates/io/or-io/src/gta6/{save_codec.rs => save/codec/mod.rs} (99%) rename crates/io/or-io/src/gta6/{save_codec_tests.rs => save/codec/tests.rs} (100%) rename crates/io/or-io/src/gta6/{save_crypto.rs => save/crypto/mod.rs} (99%) rename crates/io/or-io/src/gta6/{save_crypto_tests.rs => save/crypto/tests.rs} (100%) rename crates/io/or-io/src/gta6/{save.rs => save/mod.rs} (99%) rename crates/io/or-io/src/gta6/{save_stats.rs => save/stats/mod.rs} (99%) rename crates/io/or-io/src/gta6/{save_stats_tests.rs => save/stats/tests.rs} (100%) rename crates/io/or-io/src/gta6/{save_story.rs => save/story/mod.rs} (99%) rename crates/io/or-io/src/gta6/{save_story_tests.rs => save/story/tests.rs} (100%) rename crates/io/or-io/src/gta6/{save_tests.rs => save/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{cfg.rs => cfg/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{cfg_tests.rs => cfg/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{compiled_asm.rs => compiled/disasm/asm/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{compiled_asm_tests.rs => compiled/disasm/asm/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{disasm.rs => compiled/disasm/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{disasm_tests.rs => compiled/disasm/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{compiled_edit.rs => compiled/edit/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{compiled_edit_tests.rs => compiled/edit/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{compiled.rs => compiled/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{decode.rs => decode/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{decode_steps.rs => decode/steps.rs} (100%) rename crates/io/or-io/src/gta6/script/{decode_tests.rs => decode/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{emit_access.rs => emit/access.rs} (100%) rename crates/io/or-io/src/gta6/script/{emit.rs => emit/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{emit_tests.rs => emit/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{exec_members_tests.rs => exec/corpus/members.rs} (100%) rename crates/io/or-io/src/gta6/script/{exec_corpus_tests.rs => exec/corpus/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{exec_async_tests.rs => exec/corpus/written.rs} (100%) rename crates/io/or-io/src/gta6/script/{exec_inputs_tests.rs => exec/inputs.rs} (100%) rename crates/io/or-io/src/gta6/script/{exec_tests.rs => exec/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{exec_proofs_tests.rs => exec/proofs.rs} (100%) rename crates/io/or-io/src/gta6/script/{ir.rs => ir/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{ir_tests.rs => ir/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{lift.rs => lift/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{lift_sized.rs => lift/sizing.rs} (100%) rename crates/io/or-io/src/gta6/script/{lift_tests.rs => lift/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{listing.rs => listing/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{listing_tests.rs => listing/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{names_likely.rs => names/likely/mod.rs} (98%) rename crates/io/or-io/src/gta6/script/{names_likely_tests.rs => names/likely/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{names.rs => names/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{names_natives.rs => names/natives/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{names_natives_tests.rs => names/natives/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{names_search.rs => names/search/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{names_search_tests.rs => names/search/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{names_slots.rs => names/slots/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{names_slots_tests.rs => names/slots/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{names_tests.rs => names/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{names_words.rs => names/words/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{ => names/words}/names_words.txt (100%) rename crates/io/or-io/src/gta6/script/{names_words_tests.rs => names/words/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{native_addresses.rs => native_addresses/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{native_addresses_tests.rs => native_addresses/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{opcode.rs => opcode/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{opcode_table.rs => opcode/table.rs} (100%) rename crates/io/or-io/src/gta6/script/{opcode_tests.rs => opcode/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{options.rs => options/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{options_tests.rs => options/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{aggregates_kinds.rs => aggregates/kinds/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{aggregates_kinds_tests.rs => aggregates/kinds/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{aggregates.rs => aggregates/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{aggregates_tests.rs => aggregates/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_assigned.rs => async_await/assigned/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{async_await_assigned_tests.rs => async_await/assigned/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_across.rs => async_await/calls/across.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_calls.rs => async_await/calls/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{async_await_twin.rs => async_await/calls/twin/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{async_await_twin_tests.rs => async_await/calls/twin/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_ends.rs => async_await/ends.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_frame.rs => async_await/frame.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_guard.rs => async_await/guard.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_hoist.rs => async_await/hoist.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_iterated.rs => async_await/iterated/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{async_await_iterated_tests.rs => async_await/iterated/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_kick.rs => async_await/kick.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await.rs => async_await/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{async_await_place.rs => async_await/place/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{async_await_place_tests.rs => async_await/place/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_calls_tests.rs => async_await/tests/calling.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_hide_tests.rs => async_await/tests/hide.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_hoist_tests.rs => async_await/tests/hoisting.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{async_await_tests.rs => async_await/tests/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{async_await_yield.rs => async_await/yields/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{async_await_yield_tests.rs => async_await/yields/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{classes_fields.rs => classes/fields/mod.rs} (98%) rename crates/io/or-io/src/gta6/script/passes/{classes_fields_tests.rs => classes/fields/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{classes_frame.rs => classes/frame/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{classes_frame_tests.rs => classes/frame/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{classes.rs => classes/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{classes_properties.rs => classes/properties.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{classes_tests.rs => classes/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{classes_typed.rs => classes/typed/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{classes_typed_tests.rs => classes/typed/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{closures.rs => closures/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{closures_tests.rs => closures/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{coalesce.rs => coalesce/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{coalesce_tests.rs => coalesce/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{default_last.rs => default_last/mod.rs} (98%) rename crates/io/or-io/src/gta6/script/passes/{default_last_tests.rs => default_last/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{fields.rs => fields/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{fields_tests.rs => fields/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{forward_flow.rs => forward/flow.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{forward.rs => forward/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{forward_tests.rs => forward/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{interproc.rs => interproc/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{interproc_tests.rs => interproc/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{names_across.rs => names/across/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{names_across_tests.rs => names/across/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{names.rs => names/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{names_order.rs => names/order/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{names_order_tests.rs => names/order/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{names_shapes.rs => names/shapes/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{names_shapes_tests.rs => names/shapes/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{names_stated.rs => names/stated/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{names_stated_tests.rs => names/stated/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{names_tests.rs => names/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{structure_cases.rs => structure/cases.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{structure_cond.rs => structure/cond/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{structure_cond_tests.rs => structure/cond/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{structure_exits.rs => structure/exits/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{structure_exits_tests.rs => structure/exits/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{structure_graph.rs => structure/graph.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{structure_inlined.rs => structure/inlined/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{structure_inlined_tests.rs => structure/inlined/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{structure_layout.rs => structure/layout.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{structure.rs => structure/mod.rs} (98%) rename crates/io/or-io/src/gta6/script/passes/{structure_region.rs => structure/region.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{structure_tails.rs => structure/tails/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{structure_tails_tests.rs => structure/tails/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{structure_tests.rs => structure/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{sugar_boxes.rs => sugar_expressions/boxes/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{sugar_boxes_tests.rs => sugar_expressions/boxes/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{sugar_expressions.rs => sugar_expressions/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{sugar_switch.rs => sugar_expressions/switch/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{sugar_switch_tests.rs => sugar_expressions/switch/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{sugar_expressions_nested_tests.rs => sugar_expressions/tests/inside.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{sugar_expressions_tests.rs => sugar_expressions/tests/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{sugar_runtime.rs => sugar_runtime/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{sugar_runtime_table.rs => sugar_runtime/table.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{sugar_runtime_tests.rs => sugar_runtime/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{sugar_statements_enumerators.rs => sugar_statements/enumerators/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{sugar_statements_enumerators_tests.rs => sugar_statements/enumerators/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{sugar_statements_guards.rs => sugar_statements/guards/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{sugar_statements_guards_tests.rs => sugar_statements/guards/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{sugar_statements_lists.rs => sugar_statements/lists/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{sugar_statements_lists_tests.rs => sugar_statements/lists/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{sugar_statements.rs => sugar_statements/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{sugar_statements_tests.rs => sugar_statements/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{types_kinds.rs => types/kinds.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{types.rs => types/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{types_objects.rs => types/objects/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{types_objects_tests.rs => types/objects/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{types_tests.rs => types/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{values_cells.rs => values/cells.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{values_effects.rs => values/effects.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{values_fold_across.rs => values/fold/across/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{values_fold_across_tests.rs => values/fold/across/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{values_fold_chain.rs => values/fold/chain/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{values_fold_chain_tests.rs => values/fold/chain/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{values_fold.rs => values/fold/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{values_fold_made.rs => values/fold/objects/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{values_fold_made_tests.rs => values/fold/objects/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{values_fold_tests.rs => values/fold/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{values_joins.rs => values/joins.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{values_locals.rs => values/locals/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{values_locals_tests.rs => values/locals/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/passes/{values.rs => values/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/passes/{values_tests.rs => values/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_bare.rs => print/bare/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_bare_tests.rs => print/bare/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_sugar.rs => print/constructs/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_sugar_tests.rs => print/constructs/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_csharp.rs => print/csharp/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_csharp_tests.rs => print/csharp/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_enums.rs => print/enums/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_enums_tests.rs => print/enums/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_inlined.rs => print/inlined.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_async.rs => print/iterators.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_lambda_jumps.rs => print/lambda/jumps.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_lambda.rs => print/lambda/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_lambda_tests.rs => print/lambda/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_lambda_through.rs => print/lambda/through.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_lambda_widths.rs => print/lambda/widths.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_lay.rs => print/lay/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_lay_tests.rs => print/lay/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_legend.rs => print/legend.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_member.rs => print/members/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_member_tests.rs => print/members/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print.rs => print/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_natives.rs => print/natives/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_natives_tests.rs => print/natives/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_old.rs => print/old.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_prelude.rs => print/prelude/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_prelude_tests.rs => print/prelude/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_property.rs => print/property/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_property_tests.rs => print/property/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_spell.rs => print/spell/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{print_spell_tests.rs => print/spell/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{print_tests.rs => print/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{program_functions.rs => program/functions.rs} (100%) rename crates/io/or-io/src/gta6/script/{program.rs => program/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{program_read.rs => program/read.rs} (100%) rename crates/io/or-io/src/gta6/script/{program_tests.rs => program/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{index.rs => index/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/project/{index_tests.rs => index/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{layouts_flows.rs => layouts/flows.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{layouts.rs => layouts/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/project/{layouts_tests.rs => layouts/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{outside_async.rs => outside/asyncs.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{outside.rs => outside/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/project/{outside_tests.rs => outside/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{reach.rs => reach/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/project/{reach_tests.rs => reach/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{signatures_arguments.rs => signatures/arguments/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/project/{signatures_arguments_tests.rs => signatures/arguments/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{signatures.rs => signatures/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/project/{signatures_shared.rs => signatures/shared.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{signatures_sites.rs => signatures/sites.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{signatures_tests.rs => signatures/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{project_tests.rs => tests.rs} (100%) rename crates/io/or-io/src/gta6/script/project/{types.rs => types/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/project/{types_tests.rs => types/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{reparse_bare.rs => reparse/bare.rs} (100%) rename crates/io/or-io/src/gta6/script/{reparse_enums.rs => reparse/enums.rs} (100%) rename crates/io/or-io/src/gta6/script/{reparse_file.rs => reparse/file/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{reparse_file_tests.rs => reparse/file/tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{reparse_inlined.rs => reparse/inlined.rs} (100%) rename crates/io/or-io/src/gta6/script/{reparse_members.rs => reparse/members.rs} (100%) rename crates/io/or-io/src/gta6/script/{reparse.rs => reparse/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{reparse_property.rs => reparse/property.rs} (100%) rename crates/io/or-io/src/gta6/script/{reparse_tests.rs => reparse/tests/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{reparse_source_tests.rs => reparse/tests/source.rs} (100%) rename crates/io/or-io/src/gta6/script/{sample_tests.rs => sample.rs} (100%) rename crates/io/or-io/src/gta6/script/{mod_tests.rs => tests.rs} (100%) rename crates/io/or-io/src/gta6/script/{tree.rs => tree/mod.rs} (99%) rename crates/io/or-io/src/gta6/script/{tree_tests.rs => tree/tests.rs} (100%) rename crates/io/or-io/src/gta6/{script_bodies.rs => script_bodies/mod.rs} (99%) rename crates/io/or-io/src/gta6/{script_bodies_tests.rs => script_bodies/tests.rs} (100%) rename crates/io/or-io/src/gta6/{terrain_tile.rs => terrain_tile/mod.rs} (99%) rename crates/io/or-io/src/gta6/{terrain_tile_tests.rs => terrain_tile/tests.rs} (100%) rename crates/io/or-io/src/gta6/{text_edit.rs => text/edit/mod.rs} (99%) rename crates/io/or-io/src/gta6/{text_edit_tests.rs => text/edit/tests.rs} (100%) rename crates/io/or-io/src/gta6/{text.rs => text/mod.rs} (99%) rename crates/io/or-io/src/gta6/{text_tests.rs => text/tests.rs} (100%) rename crates/io/or-io/src/gta6/{text_language.rs => text_language/mod.rs} (99%) rename crates/io/or-io/src/gta6/{text_language_tests.rs => text_language/tests.rs} (100%) rename crates/io/or-io/src/gta6/{timecycle.rs => timecycle/mod.rs} (99%) rename crates/io/or-io/src/gta6/{timecycle_tests.rs => timecycle/tests.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_calibrate.rs => ttpf/calibrate.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf.rs => ttpf/mod.rs} (99%) rename crates/io/or-io/src/gta6/{ttpf_author_tests.rs => ttpf/tests/author.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_calibrate_tests.rs => ttpf/tests/calibrated.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_bcpack_tests.rs => ttpf/tests/coder.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_envelope_tests.rs => ttpf/tests/envelope.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_tests.rs => ttpf/tests/mod.rs} (98%) rename crates/io/or-io/src/gta6/{ttpf_relayout_tests.rs => ttpf/tests/relayout/mod.rs} (99%) rename crates/io/or-io/src/gta6/{ttpf_reshape_slices_tests.rs => ttpf/tests/relayout/slices.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_reshape_volume_tests.rs => ttpf/tests/relayout/volume.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_slice_tests.rs => ttpf/tests/slice_replace.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_volume_tests.rs => ttpf/tests/volumes.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_write_tests.rs => ttpf/tests/write.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_write.rs => ttpf/write/mod.rs} (99%) rename crates/io/or-io/src/gta6/{ttpf_recode.rs => ttpf/write/recode.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_relayout.rs => ttpf/write/relayout/mod.rs} (99%) rename crates/io/or-io/src/gta6/{ttpf_reshape_slices.rs => ttpf/write/relayout/slices.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_reshape_volume.rs => ttpf/write/relayout/volume.rs} (100%) rename crates/io/or-io/src/gta6/{ttpf_slice.rs => ttpf/write/slice.rs} (100%) rename crates/io/or-io/src/gta6/{ui_tree.rs => ui_tree/mod.rs} (99%) rename crates/io/or-io/src/gta6/{ui_tree_tests.rs => ui_tree/tests.rs} (100%) rename crates/io/or-io/src/gta6/{water_fog.rs => water/fog.rs} (100%) rename crates/io/or-io/src/gta6/{water_height.rs => water/height/mod.rs} (99%) rename crates/io/or-io/src/gta6/{water_height_tests.rs => water/height/tests.rs} (100%) rename crates/io/or-io/src/gta6/{water.rs => water/mod.rs} (99%) rename crates/io/or-io/src/gta6/{water_tests.rs => water/tests.rs} (100%) rename crates/io/or-io/src/gta6/{water_waves.rs => water/waves.rs} (100%) rename crates/io/or-io/src/gta6/{weather.rs => weather/mod.rs} (99%) rename crates/io/or-io/src/gta6/{weather_tests.rs => weather/tests.rs} (100%) rename crates/io/or-io/src/gta6/{world_state.rs => world_state/mod.rs} (99%) rename crates/io/or-io/src/gta6/{world_state_tests.rs => world_state/tests.rs} (100%) rename crates/tools/or-cli/src/gta6/{hashes.rs => hashes/mod.rs} (99%) rename crates/tools/or-cli/src/gta6/{hashes_tests.rs => hashes/tests.rs} (100%) rename crates/tools/or-cli/src/gta6/import/{geometry.rs => geometry/mod.rs} (99%) rename crates/tools/or-cli/src/gta6/import/{geometry_tests.rs => geometry/tests.rs} (100%) rename crates/tools/or-cli/src/gta6/names_mine/{named.rs => named/mod.rs} (99%) rename crates/tools/or-cli/src/gta6/names_mine/{named_tests.rs => named/tests.rs} (100%) rename src/state/document/{gta6_script_build.rs => gta6_script/build/mod.rs} (99%) rename src/state/document/{gta6_script_build_tests.rs => gta6_script/build/tests.rs} (100%) rename src/state/document/{gta6_script_jobs.rs => gta6_script/jobs.rs} (100%) rename src/state/document/{gta6_script_lists.rs => gta6_script/lists.rs} (100%) rename src/state/document/{gta6_script.rs => gta6_script/mod.rs} (99%) rename src/state/document/{gta6_script_tests.rs => gta6_script/tests.rs} (100%) rename src/state/document/{ => meta}/a_document_that_will_not_save.rs (100%) rename src/state/document/{meta.rs => meta/mod.rs} (99%) rename src/state/{file_io.rs => file_io/mod.rs} (99%) rename src/state/{ => file_io}/save_source.rs (100%) rename src/state/{ => files_view}/rpf9_tree_row_kind.rs (100%) rename src/state/{gta6_anim_edit.rs => gta6/anim/gta6_anim_edit/mod.rs} (93%) rename src/state/{gta6_anim_edit_tests.rs => gta6/anim/gta6_anim_edit/tests.rs} (100%) rename src/state/{ => gta6/anim}/gta6_anim_in_audio_save.rs (92%) rename src/state/{ => gta6/anim}/gta6_anim_keys.rs (99%) rename src/state/{ => gta6/anim}/gta6_anim_play.rs (97%) rename src/state/{gta6_bone_edit.rs => gta6/anim/gta6_bone_edit/mod.rs} (89%) rename src/state/{gta6_bone_edit_tests.rs => gta6/anim/gta6_bone_edit/tests.rs} (100%) rename src/state/{ => gta6/anim}/gta6_clip_finding.rs (95%) rename src/state/{ => gta6/anim}/gta6_entry_skeletons.rs (92%) rename src/state/{ => gta6/anim}/gta6_expression_edit.rs (96%) rename src/state/{gta6_face.rs => gta6/anim/gta6_face/mod.rs} (96%) rename src/state/{gta6_face_tests.rs => gta6/anim/gta6_face/tests.rs} (100%) rename src/state/{ => gta6/anim}/gta6_filter_edit.rs (96%) rename src/state/{ => gta6/anim}/gta6_filter_entries.rs (96%) rename src/state/{gta6_set_finding.rs => gta6/anim/gta6_set_finding/mod.rs} (95%) rename src/state/{gta6_set_finding_tests.rs => gta6/anim/gta6_set_finding/tests.rs} (98%) create mode 100644 src/state/gta6/anim/mod.rs rename src/state/{gta6_audio_links.rs => gta6/audio/gta6_audio_links/mod.rs} (97%) rename src/state/{gta6_audio_links_tests.rs => gta6/audio/gta6_audio_links/tests.rs} (98%) rename src/state/{gta6_dialogue.rs => gta6/audio/gta6_dialogue/mod.rs} (97%) rename src/state/{gta6_dialogue_tests.rs => gta6/audio/gta6_dialogue/tests.rs} (100%) rename src/state/{ => gta6/audio}/gta6_text.rs (98%) create mode 100644 src/state/gta6/audio/mod.rs rename src/state/{gta6_meta_save.rs => gta6/bodies/gta6_meta_save/mod.rs} (95%) rename src/state/{gta6_data_xml_splice.rs => gta6/bodies/gta6_meta_save/splice.rs} (100%) rename src/state/{gta6_other_bodies.rs => gta6/bodies/gta6_other_bodies/mod.rs} (97%) rename src/state/{gta6_move_nodes.rs => gta6/bodies/gta6_other_bodies/nodes.rs} (100%) rename src/state/{height_map_cell.rs => gta6/bodies/gta6_other_bodies_save/cell.rs} (100%) rename src/state/{gta6_other_bodies_save.rs => gta6/bodies/gta6_other_bodies_save/mod.rs} (95%) rename src/state/{ => gta6/bodies}/gta6_resource.rs (95%) rename src/state/{gta6_awc_in_extent.rs => gta6/bodies/gta6_resource_save/awc_in_extent.rs} (100%) rename src/state/{gta6_resource_save.rs => gta6/bodies/gta6_resource_save/mod.rs} (86%) rename src/state/{ => gta6/bodies/gta6_resource_save}/saving_an_edited_gta_vi_text_body.rs (100%) rename src/state/{gta6_save.rs => gta6/bodies/gta6_save/mod.rs} (99%) rename src/state/{gta6_save_players.rs => gta6/bodies/gta6_save/players.rs} (100%) rename src/state/{gta6_save_story_tests.rs => gta6/bodies/gta6_save/story_tests.rs} (100%) create mode 100644 src/state/gta6/bodies/mod.rs rename src/state/{ => gta6/drawable}/gta6_constant_types.rs (92%) rename src/state/{gta6_edit.rs => gta6/drawable/gta6_edit/mod.rs} (88%) rename src/state/{gta6_edit_tests.rs => gta6/drawable/gta6_edit/tests.rs} (99%) rename src/state/{ => gta6/drawable}/gta6_effect_facts.rs (97%) rename src/state/{ => gta6/drawable}/gta6_effects.rs (87%) rename src/state/{ => gta6/drawable}/gta6_export.rs (76%) rename src/state/{ => gta6/drawable}/gta6_fragment.rs (94%) rename src/state/{ => gta6/drawable}/gta6_fragment_records.rs (97%) rename src/state/{gta6_gltf_import.rs => gta6/drawable/gta6_gltf_import/mod.rs} (92%) rename src/state/{gta6_gltf_import_tests.rs => gta6/drawable/gta6_gltf_import/tests.rs} (99%) rename src/state/{ => gta6/drawable}/gta6_head.rs (96%) rename src/state/{gta6_material_declared.rs => gta6/drawable/gta6_material_declared/mod.rs} (99%) rename src/state/{gta6_material_declared_tests.rs => gta6/drawable/gta6_material_declared/tests.rs} (100%) rename src/state/{gta6_material_layout.rs => gta6/drawable/gta6_material_layout/mod.rs} (97%) rename src/state/{gta6_material_layout_tests.rs => gta6/drawable/gta6_material_layout/tests.rs} (100%) rename src/state/{ => gta6/drawable}/gta6_morph.rs (92%) rename src/state/{ => gta6/drawable}/gta6_selected.rs (93%) rename src/state/{gta6_forward_passes.rs => gta6/drawable/gta6_shaders/forward_passes.rs} (100%) rename src/state/{gta6_global_textures.rs => gta6/drawable/gta6_shaders/global_textures.rs} (100%) rename src/state/{gta6_layer_index.rs => gta6/drawable/gta6_shaders/layer_index.rs} (100%) rename src/state/{gta6_shaders.rs => gta6/drawable/gta6_shaders/mod.rs} (98%) rename src/state/{gta6_ped_assets.rs => gta6/drawable/gta6_shaders/ped_assets/mod.rs} (99%) rename src/state/{gta6_skin_tones.rs => gta6/drawable/gta6_shaders/ped_assets/skin_tones.rs} (100%) rename src/state/{gta6_terrain_tile.rs => gta6/drawable/gta6_shaders/terrain_tile.rs} (100%) rename src/state/{gta6_shaders_tests.rs => gta6/drawable/gta6_shaders/tests.rs} (100%) rename src/state/{gta6_timecycle.rs => gta6/drawable/gta6_shaders/timecycle.rs} (100%) rename src/state/{gta6_shader_translator.rs => gta6/drawable/gta6_shaders/translator.rs} (100%) rename src/state/{ => gta6/drawable}/gta6_summaries.rs (82%) rename src/state/{ => gta6/drawable}/gta6_weapon_parts.rs (96%) create mode 100644 src/state/gta6/drawable/mod.rs rename src/state/{ => gta6/install}/gta6_first_entry.rs (96%) rename src/state/{ => gta6/install}/gta6_install_harvest.rs (91%) rename src/state/{ => gta6/install}/gta6_install_scan.rs (97%) rename src/state/{ => gta6/install}/gta6_key_words.rs (94%) rename src/state/{ => gta6/install}/gta6_learned_names.rs (100%) rename src/state/{ => gta6/install}/gta6_name_pool.rs (68%) rename src/state/{ => gta6/install}/gta6_names.rs (95%) rename src/state/{ => gta6/install}/gta6_object_trees.rs (95%) rename src/state/{ => gta6/install}/gta6_small.rs (89%) rename src/state/{ => gta6/install}/gta_vi.rs (95%) create mode 100644 src/state/gta6/install/mod.rs create mode 100644 src/state/gta6/mod.rs rename src/state/{gta6_modding => gta6/modding}/anim_replace.rs (100%) rename src/state/{gta6_modding => gta6/modding}/audio_replace.rs (100%) rename src/state/{gta6_modding => gta6/modding}/batch_export.rs (100%) rename src/state/{gta6_modding => gta6/modding}/mod.rs (100%) rename src/state/{gta6_modding/mod_package.rs => gta6/modding/mod_package/mod.rs} (99%) rename src/state/{gta6_modding/mod_package_tests.rs => gta6/modding/mod_package/tests.rs} (100%) rename src/state/{gta6_modding => gta6/modding}/mod_package_changes.rs (100%) rename src/state/{gta6_modding/mod_package_install.rs => gta6/modding/mod_package_install/mod.rs} (99%) rename src/state/{gta6_modding/mod_package_install_tests.rs => gta6/modding/mod_package_install/tests.rs} (100%) rename src/state/{gta6_modding/model_replace.rs => gta6/modding/model_replace/mod.rs} (99%) rename src/state/{gta6_modding/model_replace_tests.rs => gta6/modding/model_replace/tests.rs} (100%) rename src/state/{gta6_modding => gta6/modding}/motion_loop.rs (100%) rename src/state/{gta6_modding => gta6/modding}/references.rs (100%) rename src/state/{gta6_modding/text_search.rs => gta6/modding/text_search/mod.rs} (99%) rename src/state/{gta6_modding/text_search_tests.rs => gta6/modding/text_search/tests.rs} (100%) rename src/state/{gta6_modding => gta6/modding}/texture_replace.rs (100%) rename src/state/{gta6_modding/typed_forms_handling.rs => gta6/modding/typed_forms/handling.rs} (100%) rename src/state/{gta6_modding/typed_forms.rs => gta6/modding/typed_forms/mod.rs} (98%) rename src/state/{gta6_modding/typed_forms_peds.rs => gta6/modding/typed_forms/peds.rs} (100%) rename src/state/{gta6_modding/typed_forms_population.rs => gta6/modding/typed_forms/population.rs} (100%) rename src/state/{gta6_modding/typed_forms_tests.rs => gta6/modding/typed_forms/tests.rs} (100%) rename src/state/{gta6_modding/typed_forms_weapons.rs => gta6/modding/typed_forms/weapons.rs} (100%) rename src/state/{ => gta6/particles}/gta6_particle_models.rs (94%) rename src/state/{gta6_particle_colour.rs => gta6/particles/gta6_particles/colour_max.rs} (100%) rename src/state/{gta6_particles.rs => gta6/particles/gta6_particles/mod.rs} (97%) rename src/state/{gta6_particle_raw.rs => gta6/particles/gta6_particles/raw.rs} (100%) rename src/state/{gta6_particle_spawners.rs => gta6/particles/gta6_particles/spawners.rs} (100%) rename src/state/{gta6_particle_sprites.rs => gta6/particles/gta6_particles/sprites.rs} (100%) rename src/state/{gta6_particle_colour_tests.rs => gta6/particles/gta6_particles/tests/colour.rs} (100%) rename src/state/{gta6_particles_tests.rs => gta6/particles/gta6_particles/tests/mod.rs} (98%) rename src/state/{gta6_particles_open_tests.rs => gta6/particles/gta6_particles/tests/open.rs} (100%) rename src/state/{gta6_particles_remove_tests.rs => gta6/particles/gta6_particles/tests/remove.rs} (100%) rename src/state/{gta6_particles_copies.rs => gta6/particles/gta6_particles_save/copies.rs} (99%) rename src/state/{gta6_particles_save.rs => gta6/particles/gta6_particles_save/mod.rs} (95%) rename src/state/{gta6_particles_remove.rs => gta6/particles/gta6_particles_save/remove.rs} (100%) create mode 100644 src/state/gta6/particles/mod.rs rename src/state/{ => gta6/physics}/gta6_bound.rs (96%) rename src/state/{ => gta6/physics}/gta6_bound_vertex.rs (98%) rename src/state/{gta6_collision_edit.rs => gta6/physics/gta6_collision_edit/mod.rs} (98%) rename src/state/{gta6_collision_edit_tests.rs => gta6/physics/gta6_collision_edit/tests.rs} (100%) rename src/state/{ => gta6/physics}/gta6_navmesh.rs (96%) rename src/state/{gta6_navmesh_links.rs => gta6/physics/gta6_navmesh_delete/links.rs} (100%) rename src/state/{gta6_navmesh_look.rs => gta6/physics/gta6_navmesh_delete/look.rs} (100%) rename src/state/{gta6_navmesh_delete.rs => gta6/physics/gta6_navmesh_delete/mod.rs} (95%) rename src/state/{ => gta6/physics}/gta6_navmesh_edit.rs (94%) rename src/state/{gta6_bound_reshape.rs => gta6/physics/gta6_physics_edit/bound_reshape.rs} (100%) rename src/state/{gta6_physics_edit.rs => gta6/physics/gta6_physics_edit/mod.rs} (94%) rename src/state/{gta6_physics_edit_tests.rs => gta6/physics/gta6_physics_edit/tests.rs} (100%) create mode 100644 src/state/gta6/physics/mod.rs rename src/state/{ => gta6/textures}/gta6_dictionary_index.rs (91%) rename src/state/{gta6_dictionary_write.rs => gta6/textures/gta6_dictionary_write/mod.rs} (91%) rename src/state/{gta6_dictionary_write_tests.rs => gta6/textures/gta6_dictionary_write/tests.rs} (100%) rename src/state/{gta6_embedded_edit.rs => gta6/textures/gta6_embedded_edit/mod.rs} (93%) rename src/state/{gta6_embedded_edit_tests.rs => gta6/textures/gta6_embedded_edit/tests.rs} (97%) rename src/state/{ => gta6/textures}/gta6_texture_index.rs (94%) rename src/state/{ => gta6/textures}/gta6_texture_names_file.rs (93%) rename src/state/{ => gta6/textures}/gta6_texture_naming.rs (92%) rename src/state/{ => gta6/textures}/gta6_textures.rs (81%) create mode 100644 src/state/gta6/textures/mod.rs rename src/state/{gta6_map_entity.rs => gta6/world/gta6_map/entity.rs} (100%) rename src/state/{gta6_map_links.rs => gta6/world/gta6_map/links/mod.rs} (99%) rename src/state/{gta6_map_links_tests.rs => gta6/world/gta6_map/links/tests.rs} (100%) rename src/state/{gta6_map.rs => gta6/world/gta6_map/mod.rs} (96%) rename src/state/{gta6_map_tests.rs => gta6/world/gta6_map/tests.rs} (99%) rename src/state/{gta6_map_types_edit.rs => gta6/world/gta6_map/types_edit.rs} (100%) rename src/state/{gta6_world_delete.rs => gta6/world/gta6_map/world_delete.rs} (100%) rename src/state/{ => gta6/world}/gta6_map_edit.rs (96%) rename src/state/{gta6_world_fill.rs => gta6/world/gta6_world/fill.rs} (100%) rename src/state/{gta6_world.rs => gta6/world/gta6_world/mod.rs} (93%) rename src/state/{gta6_world_tests.rs => gta6/world/gta6_world/tests.rs} (100%) rename src/state/{gta6_worldview/edit_tests.rs => gta6/world/gta6_world/worldview/edit.rs} (100%) rename src/state/{gta6_worldview/stream_grass.rs => gta6/world/gta6_world/worldview/grass.rs} (100%) rename src/state/{gta6_worldview => gta6/world/gta6_world/worldview}/index.rs (100%) rename src/state/{gta6_worldview/keys_tests.rs => gta6/world/gta6_world/worldview/keys.rs} (100%) rename src/state/{gta6_worldview => gta6/world/gta6_world/worldview}/mod.rs (99%) rename src/state/{gta6_worldview/model.rs => gta6/world/gta6_world/worldview/model/mod.rs} (99%) rename src/state/{gta6_worldview/model_tests.rs => gta6/world/gta6_world/worldview/model/tests.rs} (100%) rename src/state/{gta6_worldview/pick_tests.rs => gta6/world/gta6_world/worldview/pick.rs} (100%) rename src/state/{gta6_worldview/reference_tests.rs => gta6/world/gta6_world/worldview/reference/mod.rs} (99%) rename src/state/{gta6_worldview/reference_parts_tests.rs => gta6/world/gta6_world/worldview/reference/parts.rs} (100%) rename src/state/{gta6_worldview => gta6/world/gta6_world/worldview}/sky.rs (100%) rename src/state/{gta6_worldview/stream_viewer_tests.rs => gta6/world/gta6_world/worldview/stream_viewer.rs} (100%) rename src/state/{gta6_worldview/texture.rs => gta6/world/gta6_world/worldview/texture/mod.rs} (99%) rename src/state/{gta6_worldview/texture_tests.rs => gta6/world/gta6_world/worldview/texture/tests.rs} (100%) rename src/state/{gta6_worldview/water_ground.rs => gta6/world/gta6_world/worldview/water/ground.rs} (100%) rename src/state/{gta6_worldview/water.rs => gta6/world/gta6_world/worldview/water/mod.rs} (99%) rename src/state/{gta6_worldview/whole_tests.rs => gta6/world/gta6_world/worldview/whole.rs} (100%) rename src/state/{ => gta6/world}/gta6_world_edit.rs (96%) rename src/state/{ => gta6/world}/gta6_world_fits.rs (96%) create mode 100644 src/state/gta6/world/mod.rs rename src/state/{prefs.rs => prefs/mod.rs} (99%) rename src/state/{ => prefs}/prefs_ago.rs (100%) create mode 100644 src/state/rpf/mod.rs rename src/state/{ => rpf}/rpf9_counted_names.rs (93%) rename src/state/{ => rpf}/rpf9_kept.rs (95%) rename src/state/{ => rpf}/rpf9_list.rs (99%) rename src/state/{ => rpf/rpf9_scan/ciphered}/gta6_script_view.rs (100%) rename src/state/{rpf9_scan_ciphered.rs => rpf/rpf9_scan/ciphered/mod.rs} (96%) rename src/state/{ => rpf/rpf9_scan}/extracting_a_gta_vi_body.rs (100%) rename src/state/{ => rpf/rpf9_scan}/gta6_data_xml.rs (100%) rename src/state/{rpf9_scan.rs => rpf/rpf9_scan/mod.rs} (89%) rename src/state/{rpf9_scan_payload.rs => rpf/rpf9_scan/payload.rs} (99%) rename src/state/{gta6_archive_save.rs => rpf/rpf9_scan/rpf9_table/gta6_archive_save/mod.rs} (99%) rename src/state/{gta6_archive_save_tests.rs => rpf/rpf9_scan/rpf9_table/gta6_archive_save/tests.rs} (100%) rename src/state/{ => rpf/rpf9_scan/rpf9_table}/gta6_keys_flow.rs (100%) rename src/state/{ => rpf/rpf9_scan/rpf9_table}/gta6_keys_held.rs (100%) rename src/state/{rpf9_table.rs => rpf/rpf9_scan/rpf9_table/mod.rs} (98%) rename src/state/{rpf9_names_cache.rs => rpf/rpf9_scan/rpf9_table/names_cache.rs} (100%) rename src/state/{ => rpf/rpf9_scan}/rpf9_tree_actions.rs (100%) rename src/state/{rpf9_scan_view.rs => rpf/rpf9_scan/view.rs} (100%) rename src/state/{rpf_archive_open.rs => rpf/rpf_archive_open/mod.rs} (79%) rename src/state/{rpf9_tree_bind.rs => rpf/rpf_archive_open/tree_open/bind/mod.rs} (99%) rename src/state/{rpf9_tree_bind_tests.rs => rpf/rpf_archive_open/tree_open/bind/tests.rs} (100%) rename src/state/{rpf9_tree_open.rs => rpf/rpf_archive_open/tree_open/mod.rs} (99%) rename src/state/{rpf9_tree_open_names_tests.rs => rpf/rpf_archive_open/tree_open/names_tests.rs} (100%) rename src/state/{rpf9_archive_size_tests.rs => rpf/rpf_archive_open/tree_verbs/adopt/archive_size_tests.rs} (100%) rename src/state/{rpf9_tree_adopt.rs => rpf/rpf_archive_open/tree_verbs/adopt/mod.rs} (99%) rename src/state/{rpf9_tree_adopt_tests.rs => rpf/rpf_archive_open/tree_verbs/adopt/tests.rs} (100%) rename src/state/{rpf9_tree_headerless_tests.rs => rpf/rpf_archive_open/tree_verbs/headerless_tests/mod.rs} (99%) rename src/state/{gta6_app_saves_per_kind_edits.rs => rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/edits.rs} (100%) rename src/state/{gta6_app_saves_per_kind_tests.rs => rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/mod.rs} (99%) rename src/state/{gta6_app_saves_per_kind_read_back.rs => rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/read_back.rs} (100%) rename src/state/{gta6_app_saves_per_kind_rows.rs => rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/rows.rs} (100%) rename src/state/{rpf9_tree_verbs.rs => rpf/rpf_archive_open/tree_verbs/mod.rs} (99%) rename src/state/{rpf9_tree_plan_job.rs => rpf/rpf_archive_open/tree_verbs/plan_job.rs} (100%) rename src/state/{rpf9_tree_verbs_tests.rs => rpf/rpf_archive_open/tree_verbs/tests.rs} (100%) rename src/state/{ => rpf}/rpf_expansion.rs (97%) rename src/state/{ => rpf}/rpf_moves.rs (88%) rename src/state/{ => rpf}/rpf_node.rs (97%) rename src/state/{ => rpf}/rpf_records.rs (97%) rename src/state/{ => rpf}/rpf_session.rs (98%) rename src/state/{ => rpf}/rpf_tree.rs (94%) rename src/state/{ => rpf}/rpf_undo.rs (94%) rename src/state/{sinks/mod.rs => sinks.rs} (100%) rename src/state/{ => tests}/a_b_compares_the_pack_with_its_previous_kept_version.rs (100%) rename src/state/{ => tests}/a_bones_numbers_can_be_edited.rs (99%) rename src/state/{ => tests}/a_change_on_disk_keeps_the_undo_steps_beside_it.rs (97%) rename src/state/{ => tests}/a_drag_carries_every_selected_row.rs (99%) rename src/state/{ => tests}/a_drag_copies_and_a_change_of_nothing_does_nothing.rs (98%) rename src/state/{ => tests}/a_field_that_shapes_the_data_is_not_edited_in_place.rs (97%) rename src/state/{ => tests}/a_garments_cloth_is_linked_and_its_shop_ids_are_kept.rs (97%) rename src/state/{ => tests}/a_gta_vi_archive_s_scan_is_kept.rs (100%) rename src/state/{ => tests}/a_model_is_drawn_with_its_own_textures.rs (95%) rename src/state/{ => tests}/a_moved_or_deleted_archive_row_leaves_nothing_behind.rs (93%) rename src/state/{ => tests}/a_new_project.rs (97%) rename src/state/{ => tests}/a_pick_in_the_preview_opens_its_document_at_its_row.rs (99%) rename src/state/{ => tests}/a_pinned_inspector_shows_its_own_document.rs (98%) rename src/state/{ => tests}/a_plugin_asks_before_it_runs.rs (92%) rename src/state/{ => tests}/a_project_holds_only_sources.rs (98%) rename src/state/{ => tests}/a_recook_reloads_what_is_open.rs (96%) rename src/state/{ => tests}/a_rename_on_disk_waits_for_the_extraction_reading_it.rs (93%) rename src/state/{ => tests}/a_right_click_or_a_drag_selects_its_row.rs (97%) rename src/state/{ => tests}/a_save_names_its_destination.rs (88%) rename src/state/{ => tests}/a_self_check_keeps_to_itself.rs (99%) rename src/state/{ => tests}/a_skeleton_is_seen_without_an_animation.rs (99%) rename src/state/{ => tests}/a_wardrobe_edit_is_recoverable.rs (99%) rename src/state/{ => tests}/adding_a_format.rs (96%) rename src/state/{ => tests}/adding_particle_files_is_an_import.rs (96%) rename src/state/{ => tests}/adding_weapons_is_an_import.rs (98%) rename src/state/{ => tests}/an_alt_click_in_the_viewport_picks_a_model.rs (97%) rename src/state/{ => tests}/an_awc_animation_is_written_back.rs (99%) rename src/state/{ => tests}/an_awc_stream_opens_its_animation.rs (92%) rename src/state/{ => tests}/an_edit_of_the_wardrobe_is_a_step_of_undo.rs (98%) rename src/state/{ => tests}/an_edit_stays_where_it_was_made.rs (92%) rename src/state/{ => tests}/an_error_names_what_failed.rs (94%) rename src/state/{ => tests}/an_export_asks_before_it_alters_the_bytes.rs (91%) rename src/state/{ => tests}/an_extraction_holds_back_only_the_files_it_reads.rs (97%) rename src/state/{ => tests}/an_import_ends_with_a_toast_that_says_what_was_done_and_takes_it_back.rs (98%) rename src/state/{ => tests}/an_undo_finishes_or_says_why.rs (99%) rename src/state/{ => tests}/applying_a_preset.rs (98%) rename src/state/{ => tests}/authoring.rs (100%) rename src/state/{ => tests}/building_a_dlc_pack_from_the_app.rs (99%) rename src/state/{ => tests}/building_targets_from_the_app.rs (98%) rename src/state/{ => tests}/comparing_every_resource_and_archive.rs (96%) rename src/state/{ => tests}/comparing_two_files.rs (95%) rename src/state/{ => tests}/converting_from_the_app.rs (93%) rename src/state/{ => tests}/converting_in_a_modders_words.rs (99%) rename src/state/{ => tests}/converting_is_listed_and_asked_inside_its_panel.rs (98%) rename src/state/{ => tests}/copy_cut_and_paste/fields.rs (100%) rename src/state/{ => tests}/copy_cut_and_paste/files.rs (99%) rename src/state/{ => tests}/copy_cut_and_paste/mod.rs (85%) rename src/state/{ => tests}/copy_cut_and_paste/records.rs (100%) rename src/state/{ => tests}/defragmenting_an_archive.rs (94%) rename src/state/{ => tests}/destructive_file_operations_ask.rs (96%) rename src/state/{ => tests}/dropped_files.rs (87%) rename src/state/{ => tests}/dropping_and_importing_folders.rs (98%) rename src/state/{ => tests}/editing_a_clip.rs (99%) rename src/state/{ => tests}/enhanced_controls_say_so.rs (97%) rename src/state/{ => tests}/every_add_lands_where_the_tree_shows_it.rs (75%) rename src/state/{ => tests}/every_edit_undoes.rs (94%) rename src/state/{ => tests}/every_question_fits_a_narrow_window.rs (93%) rename src/state/{ => tests}/every_view_follows_every_edit.rs (99%) rename src/state/{ => tests}/every_viewer_path_takes_both_targets.rs (98%) rename src/state/{ => tests}/every_write_asks_the_jobs_reading_it.rs (89%) rename src/state/{ => tests}/every_write_into_a_folder_a_job_reads_is_refused.rs (97%) rename src/state/{ => tests}/fix_all_safe_and_the_optimiser_in_the_app.rs (98%) rename src/state/{ => tests}/gltf_in_and_out_from_the_app.rs (98%) rename src/state/{ => tests}/going_to_a_file.rs (98%) rename src/state/{ => tests}/gta6_textures_resolve_and_save.rs (91%) rename src/state/{ => tests}/importing_game_files_from_the_app.rs (92%) rename src/state/{ => tests}/maps_and_a_budget_in_the_app.rs (99%) rename src/state/{tests.rs => tests/mod.rs} (57%) rename src/state/{ => tests}/nested_archives_survive_a_save.rs (89%) rename src/state/{ => tests}/no_save_replaces_a_file_a_job_reads.rs (90%) rename src/state/{ => tests}/nothing_draws_over_what_it_belongs_to.rs (85%) rename src/state/{ => tests}/nothing_extracts_into_an_install.rs (93%) rename src/state/{ => tests}/one_place_for_background_jobs.rs (93%) rename src/state/{ => tests}/opening_a_dds.rs (93%) rename src/state/{ => tests}/opening_a_gta_vi_awc.rs (96%) rename src/state/{ => tests}/opening_a_gta_vi_body.rs (90%) rename src/state/{ => tests}/opening_a_nametable.rs (97%) rename src/state/{ => tests}/opening_a_rel.rs (98%) rename src/state/{ => tests}/opening_a_ttpf.rs (89%) rename src/state/{ => tests}/opening_a_ydd.rs (94%) rename src/state/{ => tests}/opening_an_awc.rs (97%) rename src/state/{ => tests}/opening_an_rpf9_archive.rs (90%) rename src/state/{ => tests}/opening_an_unknown_file.rs (96%) rename src/state/{ => tests}/opening_metadata_without_a_schema.rs (98%) rename src/state/{ => tests}/opening_world_dat.rs (96%) rename src/state/{ => tests}/opus_on_a_worker.rs (98%) rename src/state/{ => tests}/previewing_a_video.rs (99%) rename src/state/{ => tests}/reopening_a_built_pack_from_the_app.rs (98%) rename src/state/{ => tests}/reordering_mods_from_the_app.rs (96%) rename src/state/{ => tests}/replacing_geometry_from_the_app.rs (98%) rename src/state/{ => tests}/saving_twice_and_into_an_archive_not_yet_opened.rs (99%) rename src/state/{ => tests}/search_results_that_open.rs (97%) rename src/state/{ => tests}/settings_recents_and_small_editor_fixes.rs (96%) rename src/state/{ => tests}/shards.rs (100%) rename src/state/{ => tests}/sharing_a_project.rs (98%) rename src/state/{ => tests}/small_faults_in_the_default_views_menus_and_keys.rs (97%) rename src/state/{ => tests}/small_faults_in_the_editor_and_the_previews.rs (99%) rename src/state/{ => tests}/tabs_that_behave_like_an_editors.rs (98%) rename src/state/{ => tests}/test_scratch.rs (97%) rename src/state/{ => tests}/the_addon_ped_in_the_app.rs (97%) rename src/state/{ => tests}/the_animation_preview_draws_what_its_sources_hold.rs (98%) rename src/state/{ => tests}/the_animation_preview_follows_its_sources.rs (94%) rename src/state/{ => tests}/the_default_views_in_a_modders_words.rs (96%) rename src/state/{ => tests}/the_dressed_ped.rs (94%) rename src/state/{ => tests}/the_dressed_ped_shows_sets_the_first_person_view_and_the_floor_of_heels.rs (99%) rename src/state/{ => tests}/the_dressed_ped_wears_props.rs (100%) rename src/state/{ => tests}/the_edit_mode_is_visible_and_honest.rs (97%) rename src/state/{ => tests}/the_files_view_in_the_centre/keys.rs (100%) rename src/state/{ => tests}/the_files_view_in_the_centre/mod.rs (85%) rename src/state/{ => tests}/the_front_door.rs (97%) rename src/state/{ => tests}/the_front_door_opens_and_closes.rs (95%) rename src/state/{ => tests}/the_gate_in_front_of_every_write.rs (89%) rename src/state/{ => tests}/the_grid_and_undo_survive_an_edit_of_the_contents.rs (98%) rename src/state/{ => tests}/the_inspector_leads_with_a_summary.rs (93%) rename src/state/{ => tests}/the_lock_a_window_holds.rs (99%) rename src/state/{ => tests}/the_map_screen_holds_a_session.rs (98%) rename src/state/{ => tests}/the_map_screen_saves_with_the_project.rs (94%) rename src/state/{ => tests}/the_mesh_doctor_in_the_app.rs (99%) rename src/state/{ => tests}/the_panel_counts_the_apps_cpu_state.rs (96%) rename src/state/{ => tests}/the_panels_around_the_viewer_take_both_targets.rs (97%) rename src/state/{ => tests}/the_project_history.rs (96%) rename src/state/{ => tests}/the_project_history_across_imports_and_projects.rs (99%) rename src/state/{ => tests}/the_project_polish.rs (93%) rename src/state/{ => tests}/the_project_screens.rs (97%) rename src/state/{ => tests}/the_project_workspace.rs (91%) rename src/state/{ => tests}/the_rules_of_a_pack_are_set_and_its_problems_written_out_from_the_app.rs (97%) rename src/state/{ => tests}/the_shells_regions.rs (98%) rename src/state/{ => tests}/the_skeleton_files_own_model_can_be_hidden.rs (99%) rename src/state/{ => tests}/the_two_paths_of_the_workbench_end_to_end.rs (98%) rename src/state/{ => tests}/the_unsaved_marker_tells_the_truth.rs (92%) rename src/state/{ => tests}/the_viewport_draws_every_edit.rs (96%) rename src/state/{ => tests}/the_viewport_picks_every_line_it_draws.rs (99%) rename src/state/{ => tests}/the_viewport_picks_what_it_draws.rs (89%) rename src/state/{ => tests}/the_wardrobe_edit_operations.rs (99%) rename src/state/{ => tests}/the_wardrobe_import_breadth.rs (99%) rename src/state/{ => tests}/the_wardrobe_workspace.rs (94%) rename src/state/{ => tests}/the_world_screen_adds_and_copies.rs (98%) rename src/state/{ => tests}/the_world_screen_edits_a_project.rs (89%) rename src/state/{ => tests}/the_world_screen_has_a_manipulator.rs (93%) rename src/state/{ => tests}/the_world_screen_shows_layers.rs (98%) rename src/state/{ => tests}/the_world_screen_takes_its_keys_as_commands.rs (98%) rename src/state/{ => tests}/two_readers_of_one_archive_across_a_save.rs (92%) rename src/state/{ => tests}/undo_and_the_sliders_follow_the_pinned_inspector.rs (97%) rename src/state/{ => tests}/undo_from_files_acts_on_what_files_shows.rs (94%) rename src/state/{ => tests}/uses_and_used_by_in_the_app.rs (91%) rename src/state/{ => tests}/uses_over_a_retail_install.rs (100%) rename src/state/{ => tests}/uses_reaches_every_pack.rs (95%) rename src/state/{ => tests}/viewing_never_edits.rs (96%) rename src/state/{ => tests}/viewport_basics_for_inspecting_assets.rs (95%) rename src/state/{ => tests}/what_a_comparison_still_missed.rs (95%) rename src/state/{ => tests}/what_archive_rows_still_get_wrong.rs (96%) rename src/state/{ => tests}/what_the_create_menu_offers.rs (96%) rename src/state/{gta6_bcpack_calibration.rs => ttpf_document/calibration.rs} (100%) rename src/state/{ttpf_document.rs => ttpf_document/mod.rs} (99%) rename src/state/{ttpf_reshape.rs => ttpf_document/relaid.rs} (100%) rename src/state/workbench/{dressed.rs => dressed/mod.rs} (100%) rename src/state/workbench/{scan.rs => scan/mod.rs} (100%) rename src/state/world_session/{driven.rs => driven/mod.rs} (100%) diff --git a/.config/nextest.toml b/.config/nextest.toml index 5694d2479..37557ea0a 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -13,132 +13,132 @@ not ( | test(/^render::meshes::wheels::/) | test(/^self_check::toasts_leave_a_unit_alone::/) | test(/^ui::tests::the_top_flows_end_to_end::/) - | test(/^state::a_b_compares_the_pack_with_its_previous_kept_version::/) - | test(/^state::a_bones_numbers_can_be_edited::/) - | test(/^state::a_change_on_disk_keeps_the_undo_steps_beside_it::/) + | test(/^state::tests::a_b_compares_the_pack_with_its_previous_kept_version::/) + | test(/^state::tests::a_bones_numbers_can_be_edited::/) + | test(/^state::tests::a_change_on_disk_keeps_the_undo_steps_beside_it::/) | test(/^state::a_document_of_no_format_asks_for_no_image::/) - | test(/^state::a_drag_carries_every_selected_row::/) - | test(/^state::a_field_that_shapes_the_data_is_not_edited_in_place::/) - | test(/^state::a_garments_cloth_is_linked_and_its_shop_ids_are_kept::/) - | test(/^state::a_pick_in_the_preview_opens_its_document_at_its_row::/) - | test(/^state::a_pinned_inspector_shows_its_own_document::/) - | test(/^state::a_plugin_asks_before_it_runs::/) - | test(/^state::a_project_holds_only_sources::/) - | test(/^state::a_recook_reloads_what_is_open::/) - | test(/^state::a_rename_on_disk_waits_for_the_extraction_reading_it::/) - | test(/^state::a_right_click_or_a_drag_selects_its_row::/) - | test(/^state::a_save_names_its_destination::/) - | test(/^state::a_skeleton_is_seen_without_an_animation::/) - | test(/^state::a_wardrobe_edit_is_recoverable::/) - | test(/^state::an_extraction_holds_back_only_the_files_it_reads::/) - | test(/^state::authoring::tests::/) + | test(/^state::tests::a_drag_carries_every_selected_row::/) + | test(/^state::tests::a_field_that_shapes_the_data_is_not_edited_in_place::/) + | test(/^state::tests::a_garments_cloth_is_linked_and_its_shop_ids_are_kept::/) + | test(/^state::tests::a_pick_in_the_preview_opens_its_document_at_its_row::/) + | test(/^state::tests::a_pinned_inspector_shows_its_own_document::/) + | test(/^state::tests::a_plugin_asks_before_it_runs::/) + | test(/^state::tests::a_project_holds_only_sources::/) + | test(/^state::tests::a_recook_reloads_what_is_open::/) + | test(/^state::tests::a_rename_on_disk_waits_for_the_extraction_reading_it::/) + | test(/^state::tests::a_right_click_or_a_drag_selects_its_row::/) + | test(/^state::tests::a_save_names_its_destination::/) + | test(/^state::tests::a_skeleton_is_seen_without_an_animation::/) + | test(/^state::tests::a_wardrobe_edit_is_recoverable::/) + | test(/^state::tests::an_extraction_holds_back_only_the_files_it_reads::/) + | test(/^state::tests::authoring::tests::/) | test(/^state::checking_a_source_against_the_game::/) | test(/^state::compare::resource::tests::/) - | test(/^state::comparing_every_resource_and_archive::/) - | test(/^state::comparing_two_files::/) - | test(/^state::converting_from_the_app::/) - | test(/^state::converting_in_a_modders_words::/) - | test(/^state::converting_in_a_modders_words::every_value_the_staged_files_drop_reads_in_words_with_no_engine_path::/) - | test(/^state::converting_is_listed_and_asked_inside_its_panel::/) - | test(/^state::copy_cut_and_paste::commands::/) - | test(/^state::copy_cut_and_paste::fields::/) - | test(/^state::copy_cut_and_paste::files::/) - | test(/^state::copy_cut_and_paste::records::/) - | test(/^state::defragmenting_an_archive::/) - | test(/^state::destructive_file_operations_ask::/) + | test(/^state::tests::comparing_every_resource_and_archive::/) + | test(/^state::tests::comparing_two_files::/) + | test(/^state::tests::converting_from_the_app::/) + | test(/^state::tests::converting_in_a_modders_words::/) + | test(/^state::tests::converting_in_a_modders_words::every_value_the_staged_files_drop_reads_in_words_with_no_engine_path::/) + | test(/^state::tests::converting_is_listed_and_asked_inside_its_panel::/) + | test(/^state::tests::copy_cut_and_paste::commands::/) + | test(/^state::tests::copy_cut_and_paste::fields::/) + | test(/^state::tests::copy_cut_and_paste::files::/) + | test(/^state::tests::copy_cut_and_paste::records::/) + | test(/^state::tests::defragmenting_an_archive::/) + | test(/^state::tests::destructive_file_operations_ask::/) | test(/^state::document::hex::tests::/) | test(/^state::document::material_baseline::tests::/) | test(/^state::document::meta::a_document_that_will_not_save::/) | test(/^state::document::tests::/) | test(/^state::document_io::tests::/) - | test(/^state::dropping_and_importing_folders::/) - | test(/^state::enhanced_controls_say_so::/) - | test(/^state::every_question_fits_a_narrow_window::/) - | test(/^state::every_view_follows_every_edit::/) - | test(/^state::every_viewer_path_takes_both_targets::/) - | test(/^state::every_write_asks_the_jobs_reading_it::/) - | test(/^state::every_write_into_a_folder_a_job_reads_is_refused::/) - | test(/^state::fix_all_safe_and_the_optimiser_in_the_app::/) - | test(/^state::gltf_in_and_out_from_the_app::/) - | test(/^state::gta6_world::worldview::reference::of_the_install::/) - | test(/^state::maps_and_a_budget_in_the_app::/) - | test(/^state::no_save_replaces_a_file_a_job_reads::/) - | test(/^state::nothing_draws_over_what_it_belongs_to::/) - | test(/^state::one_place_for_background_jobs::/) - | test(/^state::opening_a_ydd::/) + | test(/^state::tests::dropping_and_importing_folders::/) + | test(/^state::tests::enhanced_controls_say_so::/) + | test(/^state::tests::every_question_fits_a_narrow_window::/) + | test(/^state::tests::every_view_follows_every_edit::/) + | test(/^state::tests::every_viewer_path_takes_both_targets::/) + | test(/^state::tests::every_write_asks_the_jobs_reading_it::/) + | test(/^state::tests::every_write_into_a_folder_a_job_reads_is_refused::/) + | test(/^state::tests::fix_all_safe_and_the_optimiser_in_the_app::/) + | test(/^state::tests::gltf_in_and_out_from_the_app::/) + | test(/^state::gta6::world::gta6_world::worldview::reference::of_the_install::/) + | test(/^state::tests::maps_and_a_budget_in_the_app::/) + | test(/^state::tests::no_save_replaces_a_file_a_job_reads::/) + | test(/^state::tests::nothing_draws_over_what_it_belongs_to::/) + | test(/^state::tests::one_place_for_background_jobs::/) + | test(/^state::tests::opening_a_ydd::/) | test(/^state::payload_handlers::tests::/) | test(/^state::plugins::a_plugin_adds_to_the_editor::/) | test(/^state::plugins::a_plugin_writes_files_together::/) | test(/^state::plugins::a_validator_suggests_a_fix_and_reads_the_pack::/) | test(/^state::plugins::an_older_plugin_still_loads::/) | test(/^state::plugins::the_cloth_painter_installs_as_a_plugin::/) - | test(/^state::replacing_geometry_from_the_app::/) - | test(/^state::sharing_a_project::the_check::/) - | test(/^state::sharing_a_project::the_zip::/) - | test(/^state::small_faults_in_the_editor_and_the_previews::/) - | test(/^state::test_scratch::/) - | test(/^state::the_animation_preview_draws_what_its_sources_hold::/) - | test(/^state::the_default_views_in_a_modders_words::/) - | test(/^state::the_default_views_in_a_modders_words::every_corpus_kind_draws_each_hash_as_a_hash_and_no_format_code_schema_path_or_stride_in_a_default_view::/) - | test(/^state::the_default_views_in_a_modders_words::every_corpus_kind_states_no_row_twice_counts_one_model_in_the_singular_and_names_no_repository_path_in_a_default_view::/) - | test(/^state::the_dressed_ped::/) - | test(/^state::the_dressed_ped_shows_sets_the_first_person_view_and_the_floor_of_heels::/) - | test(/^state::the_dressed_ped_wears_props::/) - | test(/^state::the_edit_mode_is_visible_and_honest::/) - | test(/^state::the_files_view_in_the_centre::/) - | test(/^state::the_files_view_in_the_centre::keys::/) - | test(/^state::the_files_view_in_the_centre::menus::/) - | test(/^state::the_files_view_in_the_centre::pictures::/) - | test(/^state::the_inspector_leads_with_a_summary::no_vtable_word_count_or_pointer_shows_in_the_default_inspector_of_any_corpus_kind::/) - | test(/^state::the_mesh_doctor_in_the_app::/) - | test(/^state::the_panels_around_the_viewer_take_both_targets::/) - | test(/^state::the_project_history::/) - | test(/^state::the_project_history_across_imports_and_projects::/) - | test(/^state::the_project_polish::/) - | test(/^state::the_project_screens::/) - | test(/^state::the_project_workspace::/) + | test(/^state::tests::replacing_geometry_from_the_app::/) + | test(/^state::tests::sharing_a_project::the_check::/) + | test(/^state::tests::sharing_a_project::the_zip::/) + | test(/^state::tests::small_faults_in_the_editor_and_the_previews::/) + | test(/^state::tests::test_scratch::/) + | test(/^state::tests::the_animation_preview_draws_what_its_sources_hold::/) + | test(/^state::tests::the_default_views_in_a_modders_words::/) + | test(/^state::tests::the_default_views_in_a_modders_words::every_corpus_kind_draws_each_hash_as_a_hash_and_no_format_code_schema_path_or_stride_in_a_default_view::/) + | test(/^state::tests::the_default_views_in_a_modders_words::every_corpus_kind_states_no_row_twice_counts_one_model_in_the_singular_and_names_no_repository_path_in_a_default_view::/) + | test(/^state::tests::the_dressed_ped::/) + | test(/^state::tests::the_dressed_ped_shows_sets_the_first_person_view_and_the_floor_of_heels::/) + | test(/^state::tests::the_dressed_ped_wears_props::/) + | test(/^state::tests::the_edit_mode_is_visible_and_honest::/) + | test(/^state::tests::the_files_view_in_the_centre::/) + | test(/^state::tests::the_files_view_in_the_centre::keys::/) + | test(/^state::tests::the_files_view_in_the_centre::menus::/) + | test(/^state::tests::the_files_view_in_the_centre::pictures::/) + | test(/^state::tests::the_inspector_leads_with_a_summary::no_vtable_word_count_or_pointer_shows_in_the_default_inspector_of_any_corpus_kind::/) + | test(/^state::tests::the_mesh_doctor_in_the_app::/) + | test(/^state::tests::the_panels_around_the_viewer_take_both_targets::/) + | test(/^state::tests::the_project_history::/) + | test(/^state::tests::the_project_history_across_imports_and_projects::/) + | test(/^state::tests::the_project_polish::/) + | test(/^state::tests::the_project_screens::/) + | test(/^state::tests::the_project_workspace::/) | test(/^state::the_review_pictures::/) - | test(/^state::the_rules_of_a_pack_are_set_and_its_problems_written_out_from_the_app::/) - | test(/^state::the_shells_regions::/) - | test(/^state::the_skeleton_files_own_model_can_be_hidden::/) - | test(/^state::the_two_paths_of_the_workbench_end_to_end::/) - | test(/^state::the_unsaved_marker_tells_the_truth::/) - | test(/^state::the_viewport_draws_every_edit::/) - | test(/^state::the_viewport_picks_every_line_it_draws::/) - | test(/^state::the_viewport_picks_what_it_draws::/) + | test(/^state::tests::the_rules_of_a_pack_are_set_and_its_problems_written_out_from_the_app::/) + | test(/^state::tests::the_shells_regions::/) + | test(/^state::tests::the_skeleton_files_own_model_can_be_hidden::/) + | test(/^state::tests::the_two_paths_of_the_workbench_end_to_end::/) + | test(/^state::tests::the_unsaved_marker_tells_the_truth::/) + | test(/^state::tests::the_viewport_draws_every_edit::/) + | test(/^state::tests::the_viewport_picks_every_line_it_draws::/) + | test(/^state::tests::the_viewport_picks_what_it_draws::/) | test(/^state::the_wardrobe_adds_a_folder_it_is_pointed_at::/) - | test(/^state::the_wardrobe_edit_operations::/) + | test(/^state::tests::the_wardrobe_edit_operations::/) | test(/^state::the_wardrobe_holds_texture_places::/) - | test(/^state::the_wardrobe_import_breadth::/) + | test(/^state::tests::the_wardrobe_import_breadth::/) | test(/^state::the_wardrobe_leaves_when_the_clothing_goes::/) | test(/^state::the_wardrobe_toast_undo::/) | test(/^state::the_wardrobe_undo_names_what_it_takes_back::/) - | test(/^state::the_wardrobe_workspace::/) - | test(/^state::two_readers_of_one_archive_across_a_save::/) - | test(/^state::rpf9_scan::rpf9_table::names_cache::tests::the_names_load_warm_from_the_cache_faster_than_cold$/) - | test(/^state::rpf_archive_open::tree_open::tests::a_row_of_each_shape_of_the_build_opens_at_the_size_its_table_states$/) - | test(/^state::rpf_archive_open::tree_open::names_tests::rows_of_a_real_archive_opened_from_the_tree_are_named_by_their_rows$/) - | test(/^state::rpf_archive_open::tree_verbs::tests::a_small_clear_row_of_a_real_archive_replaced_into_a_copy_reads_back$/) - | test(/^state::rpf_archive_open::tree_verbs::tests::a_small_clear_row_of_a_real_archive_changed_at_its_size_saves_as_a_patched_copy$/) - | test(/^state::rpf_archive_open::tree_open::bind::tests::a_text_row_of_the_build_saved_from_its_document_reads_back_from_a_patched_copy$/) - | test(/^state::rpf_archive_open::tree_verbs::headerless_tests::a_real_text_tables_first_text_changed_at_its_length_saves_as_a_patched_copy$/) + | test(/^state::tests::the_wardrobe_workspace::/) + | test(/^state::tests::two_readers_of_one_archive_across_a_save::/) + | test(/^state::rpf::rpf9_scan::rpf9_table::names_cache::tests::the_names_load_warm_from_the_cache_faster_than_cold$/) + | test(/^state::rpf::rpf_archive_open::tree_open::tests::a_row_of_each_shape_of_the_build_opens_at_the_size_its_table_states$/) + | test(/^state::rpf::rpf_archive_open::tree_open::names_tests::rows_of_a_real_archive_opened_from_the_tree_are_named_by_their_rows$/) + | test(/^state::rpf::rpf_archive_open::tree_verbs::tests::a_small_clear_row_of_a_real_archive_replaced_into_a_copy_reads_back$/) + | test(/^state::rpf::rpf_archive_open::tree_verbs::tests::a_small_clear_row_of_a_real_archive_changed_at_its_size_saves_as_a_patched_copy$/) + | test(/^state::rpf::rpf_archive_open::tree_open::bind::tests::a_text_row_of_the_build_saved_from_its_document_reads_back_from_a_patched_copy$/) + | test(/^state::rpf::rpf_archive_open::tree_verbs::headerless_tests::a_real_text_tables_first_text_changed_at_its_length_saves_as_a_patched_copy$/) | test(/^state::files_view::tests::gta6::a_nested_gta_vi_archive_past_4_gib_counts_its_whole_size$/) | test(/^state::files_view::tests::gta6::every_row_of_the_builds_smallest_archives_shows_what_its_row_states$/) - | test(/^state::rpf_archive_open::tree_verbs::adopt::archive_size_tests::details_sizes_a_nested_archive_as_its_column_does_past_4_gib_too$/) + | test(/^state::rpf::rpf_archive_open::tree_verbs::adopt::archive_size_tests::details_sizes_a_nested_archive_as_its_column_does_past_4_gib_too$/) | test(/^state::file_index::tests::every_row_of_the_builds_smallest_archives_is_found_by_its_stated_name_hash$/) | test(/^state::file_index::searching_every_archive::every_row_of_the_builds_smallest_archives_keeps_its_size_kind_and_hash$/) - | test(/^state::gta6_meta_save::splice::tests::a_data_xml_of_the_build_edited_at_its_length_changes_one_byte$/) - | test(/^state::gta6_resource_save::awc_in_extent::tests::a_stream_of_the_build_replaced_by_itself_re_encoded_saves_as_a_patched_copy_or_is_refused_by_name$/) - | test(/^state::rpf_archive_open::tree_verbs::headerless_tests::saves_per_kind::every_kind_the_app_edits_saved_through_its_tree_row_of_the_build_plans_patched_or_says_why$/) - | test(/^state::rpf9_scan::ciphered::ciphered_texture_open::/) - | test(/^state::rpf9_scan::rpf9_tree_actions::tests::copy_hash_gives_the_table_hash_of_every_row_of_the_builds_smallest_archives$/) - | test(/^state::uses_and_used_by_in_the_app::/) - | test(/^state::uses_reaches_every_pack::/) - | test(/^state::viewing_never_edits::opening_a_file_of_every_kind_and_drawing_every_panel_modifies_no_document::/) - | test(/^state::viewport_basics_for_inspecting_assets::/) + | test(/^state::gta6::bodies::gta6_meta_save::splice::tests::a_data_xml_of_the_build_edited_at_its_length_changes_one_byte$/) + | test(/^state::gta6::bodies::gta6_resource_save::awc_in_extent::tests::a_stream_of_the_build_replaced_by_itself_re_encoded_saves_as_a_patched_copy_or_is_refused_by_name$/) + | test(/^state::rpf::rpf_archive_open::tree_verbs::headerless_tests::saves_per_kind::every_kind_the_app_edits_saved_through_its_tree_row_of_the_build_plans_patched_or_says_why$/) + | test(/^state::rpf::rpf9_scan::ciphered::ciphered_texture_open::/) + | test(/^state::rpf::rpf9_scan::rpf9_tree_actions::tests::copy_hash_gives_the_table_hash_of_every_row_of_the_builds_smallest_archives$/) + | test(/^state::tests::uses_and_used_by_in_the_app::/) + | test(/^state::tests::uses_reaches_every_pack::/) + | test(/^state::tests::viewing_never_edits::opening_a_file_of_every_kind_and_drawing_every_panel_modifies_no_document::/) + | test(/^state::tests::viewport_basics_for_inspecting_assets::/) | test(/^state::viewport_camera::tests::/) - | test(/^state::what_a_comparison_still_missed::/) - | test(/^state::what_archive_rows_still_get_wrong::/) + | test(/^state::tests::what_a_comparison_still_missed::/) + | test(/^state::tests::what_archive_rows_still_get_wrong::/) | test(/^state::workbench::scan::a_plugin_extends_what_a_project_builds::/) | test(/^state::workbench::wardrobe_operations::tests::/) | test(/^state::workbench::watch::tests::/) @@ -274,8 +274,8 @@ not ( | test(/^container::rpf::rpf9::gta6_extract::tests::the_extracted_snapshot/) | test(/^container::rpf::rpf9::gta6_patch::tests::a_one_mebibyte_chunk_past_the_old_cap_is_patched_by_the_optimal_parse$/) | test(/^container::rpf::rpf9::gta6_extract::tests::the_real_executable_opens/) - | test(/^gta6::headerless::write_geometry::cut::palette_tests::/) - | test(/^gta6::headerless::write_geometry::per_geometry::build_tests::/) + | test(/^gta6::headerless::write::geometry::cut::palette_tests::/) + | test(/^gta6::headerless::write::geometry::per_geometry::build_tests::/) | test(/^gta6::script::native_addresses::tests::the_users_listings/) | test(/^gta6::anim::tests::write_in_extent::single_key_edits_of_the_build_s_clips_that_fit_their_blocks$/) | test(/^gta6::anim::tests::clip_signature_build::/) diff --git a/LICENSE-third-party.md b/LICENSE-third-party.md index 33c80db1b..373af621a 100644 --- a/LICENSE-third-party.md +++ b/LICENSE-third-party.md @@ -91,7 +91,7 @@ keep, then its origin. `crates/io/or-io/src/gta6/bcpack/mod.rs` is OpenRage's own, and so are `crates/io/or-io/src/gta6/bcpack/bc2.rs`, which rebuilds BC2 blocks from their fifteen lanes, `crates/io/or-io/src/gta6/bcpack/planes.rs`, which rebuilds BC1, BC3, BC4 and BC5 blocks through -tables, and `crates/io/or-io/src/gta6/bcpack/calibrate.rs`, which fits those tables on the user's +tables, and `crates/io/or-io/src/gta6/bcpack/calibrate/mod.rs`, which fits those tables on the user's machine from the user's own packs. The lane widths of the modes other than BC1 are facts stated in the documentation of [ItsNotRexed/Leonida](https://github.com/ItsNotRexed/Leonida) @@ -102,7 +102,7 @@ holds the BC2 quadrant ranks and initial preset entries adapted from its MIT licence. Both MIT notices and Xbox2Windows's MIT notice are reproduced at the end of this file. -`crates/io/or-io/src/gta6/bcpack/supplied.rs` reads a file of the coder's tables: one a user +`crates/io/or-io/src/gta6/bcpack/supplied/mod.rs` reads a file of the coder's tables: one a user supplies, else `crates/io/or-io/data/bcpack-tables.bin`, which the tree holds by the owner's ruling of 2026-11-27. That file is the one VIctory publishes, byte for byte. No licence is stated for the tables, whose they are is not known, and OpenRage's licence does not cover them. Nothing @@ -132,7 +132,7 @@ as generated source. What the reader takes from them is facts about the file's l The tree holds no measurement of these on a pack. What it shows of them is the reader and its tests, which read a made-up file in this layout -(`crates/io/or-io/src/gta6/bcpack/supplied_tests.rs`), and +(`crates/io/or-io/src/gta6/bcpack/supplied/tests.rs`), and `openrage-cli ttpf tables --check` measures a file against a user's own packs: a BC6H or BC7 list read by another layout leaves blocks no encoder writes, and the other tables are held to the plain mips beside the coded ones. The reader is OpenRage's own code. Two reviews held it diff --git a/crates/domain/or-world-gta6/src/day/exposure.rs b/crates/domain/or-world-gta6/src/day/exposure/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/day/exposure.rs rename to crates/domain/or-world-gta6/src/day/exposure/mod.rs index cd1bbe9ee..1487229db 100644 --- a/crates/domain/or-world-gta6/src/day/exposure.rs +++ b/crates/domain/or-world-gta6/src/day/exposure/mod.rs @@ -289,5 +289,4 @@ pub fn light( } #[cfg(test)] -#[path = "exposure_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/day/exposure_tests.rs b/crates/domain/or-world-gta6/src/day/exposure/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/day/exposure_tests.rs rename to crates/domain/or-world-gta6/src/day/exposure/tests.rs diff --git a/crates/domain/or-world-gta6/src/day/frame.rs b/crates/domain/or-world-gta6/src/day/frame/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/day/frame.rs rename to crates/domain/or-world-gta6/src/day/frame/mod.rs index 3d0ede327..f280b51d8 100644 --- a/crates/domain/or-world-gta6/src/day/frame.rs +++ b/crates/domain/or-world-gta6/src/day/frame/mod.rs @@ -728,5 +728,4 @@ pub fn name_hash(name: &str) -> u32 { } #[cfg(test)] -#[path = "frame_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/day/frame_tests.rs b/crates/domain/or-world-gta6/src/day/frame/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/day/frame_tests.rs rename to crates/domain/or-world-gta6/src/day/frame/tests.rs diff --git a/crates/domain/or-world-gta6/src/day/mod.rs b/crates/domain/or-world-gta6/src/day/mod.rs index a70853018..d3d022127 100644 --- a/crates/domain/or-world-gta6/src/day/mod.rs +++ b/crates/domain/or-world-gta6/src/day/mod.rs @@ -622,5 +622,4 @@ pub fn read_day(archive: &Path, stop: &dyn Fn() -> bool) -> io::Result f64 { } #[cfg(test)] -#[path = "sun_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/day/sun_tests.rs b/crates/domain/or-world-gta6/src/day/sun/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/day/sun_tests.rs rename to crates/domain/or-world-gta6/src/day/sun/tests.rs diff --git a/crates/domain/or-world-gta6/src/day/day_tests.rs b/crates/domain/or-world-gta6/src/day/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/day/day_tests.rs rename to crates/domain/or-world-gta6/src/day/tests.rs diff --git a/crates/domain/or-world-gta6/src/day/vars.rs b/crates/domain/or-world-gta6/src/day/vars/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/day/vars.rs rename to crates/domain/or-world-gta6/src/day/vars/mod.rs index 5081816d8..9f1b3afc4 100644 --- a/crates/domain/or-world-gta6/src/day/vars.rs +++ b/crates/domain/or-world-gta6/src/day/vars/mod.rs @@ -178,5 +178,4 @@ pub fn read_executable_day(archive: &Path) -> ExecutableDay { } #[cfg(test)] -#[path = "vars_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/day/vars_tests.rs b/crates/domain/or-world-gta6/src/day/vars/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/day/vars_tests.rs rename to crates/domain/or-world-gta6/src/day/vars/tests.rs diff --git a/crates/domain/or-world-gta6/src/day/weather.rs b/crates/domain/or-world-gta6/src/day/weather/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/day/weather.rs rename to crates/domain/or-world-gta6/src/day/weather/mod.rs index ae9ba3215..8126431d6 100644 --- a/crates/domain/or-world-gta6/src/day/weather.rs +++ b/crates/domain/or-world-gta6/src/day/weather/mod.rs @@ -331,5 +331,4 @@ pub fn find_in_schedule( } #[cfg(test)] -#[path = "weather_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/day/weather_tests.rs b/crates/domain/or-world-gta6/src/day/weather/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/day/weather_tests.rs rename to crates/domain/or-world-gta6/src/day/weather/tests.rs diff --git a/crates/domain/or-world-gta6/src/day/wind.rs b/crates/domain/or-world-gta6/src/day/wind/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/day/wind.rs rename to crates/domain/or-world-gta6/src/day/wind/mod.rs index c8742abf5..eebc88b6a 100644 --- a/crates/domain/or-world-gta6/src/day/wind.rs +++ b/crates/domain/or-world-gta6/src/day/wind/mod.rs @@ -501,5 +501,4 @@ impl WindState { } #[cfg(test)] -#[path = "wind_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/day/wind_tests.rs b/crates/domain/or-world-gta6/src/day/wind/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/day/wind_tests.rs rename to crates/domain/or-world-gta6/src/day/wind/tests.rs diff --git a/crates/domain/or-world-gta6/src/edit_entities_made_up.rs b/crates/domain/or-world-gta6/src/edit/entities/made_up.rs similarity index 100% rename from crates/domain/or-world-gta6/src/edit_entities_made_up.rs rename to crates/domain/or-world-gta6/src/edit/entities/made_up.rs diff --git a/crates/domain/or-world-gta6/src/edit_entities.rs b/crates/domain/or-world-gta6/src/edit/entities/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/edit_entities.rs rename to crates/domain/or-world-gta6/src/edit/entities/mod.rs index 7b3b8a49a..ee57c5071 100644 --- a/crates/domain/or-world-gta6/src/edit_entities.rs +++ b/crates/domain/or-world-gta6/src/edit/entities/mod.rs @@ -480,9 +480,7 @@ fn put( } #[cfg(any(test, feature = "made-up"))] -#[path = "edit_entities_made_up.rs"] pub mod made_up; #[cfg(test)] -#[path = "edit_entities_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/edit_entities_tests.rs b/crates/domain/or-world-gta6/src/edit/entities/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/edit_entities_tests.rs rename to crates/domain/or-world-gta6/src/edit/entities/tests.rs diff --git a/crates/domain/or-world-gta6/src/edit_extents.rs b/crates/domain/or-world-gta6/src/edit/extents.rs similarity index 100% rename from crates/domain/or-world-gta6/src/edit_extents.rs rename to crates/domain/or-world-gta6/src/edit/extents.rs diff --git a/crates/domain/or-world-gta6/src/edit.rs b/crates/domain/or-world-gta6/src/edit/mod.rs similarity index 98% rename from crates/domain/or-world-gta6/src/edit.rs rename to crates/domain/or-world-gta6/src/edit/mod.rs index 5f8b0f154..33314df34 100644 --- a/crates/domain/or-world-gta6/src/edit.rs +++ b/crates/domain/or-world-gta6/src/edit/mod.rs @@ -12,9 +12,7 @@ use or_io::meta::binary::hash_index::default_hash_index; use or_io::meta::{MetaInstance, Value}; use or_world::transform::Pose; -#[path = "edit_entities.rs"] pub mod entities; -#[path = "edit_extents.rs"] pub mod extents; pub const ENTITIES: u32 = lit(b"entities"); @@ -203,5 +201,4 @@ pub fn over(map: &StreamMap, tree: &MetaInstance) -> Option { } #[cfg(test)] -#[path = "edit_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/edit_tests.rs b/crates/domain/or-world-gta6/src/edit/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/edit_tests.rs rename to crates/domain/or-world-gta6/src/edit/tests.rs diff --git a/crates/domain/or-world-gta6/src/index_install.rs b/crates/domain/or-world-gta6/src/index/install.rs similarity index 100% rename from crates/domain/or-world-gta6/src/index_install.rs rename to crates/domain/or-world-gta6/src/index/install.rs diff --git a/crates/domain/or-world-gta6/src/index.rs b/crates/domain/or-world-gta6/src/index/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/index.rs rename to crates/domain/or-world-gta6/src/index/mod.rs index bc0389ecf..8147384c1 100644 --- a/crates/domain/or-world-gta6/src/index.rs +++ b/crates/domain/or-world-gta6/src/index/mod.rs @@ -14,19 +14,12 @@ use glam::Vec3; use or_title::gta6_mount::{self, HeldBack, MapFact, Mode, SCRIPT_MANAGED}; use or_world::streaming::MapBox; -#[path = "index_install.rs"] mod install; -#[path = "index_mount.rs"] mod mount; -#[path = "index_open.rs"] mod open; -#[path = "index_rows.rs"] mod rows; -#[path = "index_scan.rs"] mod scan; -#[path = "index_scan_table.rs"] mod scan_table; -#[path = "index_states.rs"] mod states; use or_io::gta6::map::index_types as types; use or_io::gta6::map::lights_index; diff --git a/crates/domain/or-world-gta6/src/index_mount.rs b/crates/domain/or-world-gta6/src/index/mount/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/index_mount.rs rename to crates/domain/or-world-gta6/src/index/mount/mod.rs index 60dd6dead..f7489fc29 100644 --- a/crates/domain/or-world-gta6/src/index_mount.rs +++ b/crates/domain/or-world-gta6/src/index/mount/mod.rs @@ -220,5 +220,4 @@ pub(super) fn archives_under(root: &Path) -> Vec { } #[cfg(test)] -#[path = "index_mount_tests.rs"] pub(super) mod tests; diff --git a/crates/domain/or-world-gta6/src/index_mount_tests.rs b/crates/domain/or-world-gta6/src/index/mount/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/index_mount_tests.rs rename to crates/domain/or-world-gta6/src/index/mount/tests.rs diff --git a/crates/domain/or-world-gta6/src/index_open.rs b/crates/domain/or-world-gta6/src/index/open/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/index_open.rs rename to crates/domain/or-world-gta6/src/index/open/mod.rs index b43d9bca2..7ac2f730a 100644 --- a/crates/domain/or-world-gta6/src/index_open.rs +++ b/crates/domain/or-world-gta6/src/index/open/mod.rs @@ -197,5 +197,4 @@ fn build_through( } #[cfg(test)] -#[path = "index_open_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/index_open_tests.rs b/crates/domain/or-world-gta6/src/index/open/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/index_open_tests.rs rename to crates/domain/or-world-gta6/src/index/open/tests.rs diff --git a/crates/domain/or-world-gta6/src/index_rows.rs b/crates/domain/or-world-gta6/src/index/rows.rs similarity index 100% rename from crates/domain/or-world-gta6/src/index_rows.rs rename to crates/domain/or-world-gta6/src/index/rows.rs diff --git a/crates/domain/or-world-gta6/src/index_scan.rs b/crates/domain/or-world-gta6/src/index/scan.rs similarity index 100% rename from crates/domain/or-world-gta6/src/index_scan.rs rename to crates/domain/or-world-gta6/src/index/scan.rs diff --git a/crates/domain/or-world-gta6/src/index_scan_table.rs b/crates/domain/or-world-gta6/src/index/scan_table/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/index_scan_table.rs rename to crates/domain/or-world-gta6/src/index/scan_table/mod.rs index 8c42d1356..242a2a4b4 100644 --- a/crates/domain/or-world-gta6/src/index_scan_table.rs +++ b/crates/domain/or-world-gta6/src/index/scan_table/mod.rs @@ -223,5 +223,4 @@ pub(super) fn scan_by_table( } #[cfg(test)] -#[path = "index_scan_table_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/index_scan_table_tests.rs b/crates/domain/or-world-gta6/src/index/scan_table/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/index_scan_table_tests.rs rename to crates/domain/or-world-gta6/src/index/scan_table/tests.rs diff --git a/crates/domain/or-world-gta6/src/index_states.rs b/crates/domain/or-world-gta6/src/index/states/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/index_states.rs rename to crates/domain/or-world-gta6/src/index/states/mod.rs index d646697da..e13695228 100644 --- a/crates/domain/or-world-gta6/src/index_states.rs +++ b/crates/domain/or-world-gta6/src/index/states/mod.rs @@ -247,5 +247,4 @@ pub(super) fn switches( } #[cfg(test)] -#[path = "index_states_tests.rs"] pub(super) mod tests; diff --git a/crates/domain/or-world-gta6/src/index_states_tests.rs b/crates/domain/or-world-gta6/src/index/states/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/index_states_tests.rs rename to crates/domain/or-world-gta6/src/index/states/tests.rs diff --git a/crates/domain/or-world-gta6/src/stream_census.rs b/crates/domain/or-world-gta6/src/stream/census.rs similarity index 100% rename from crates/domain/or-world-gta6/src/stream_census.rs rename to crates/domain/or-world-gta6/src/stream/census.rs diff --git a/crates/domain/or-world-gta6/src/stream_grass.rs b/crates/domain/or-world-gta6/src/stream/grass.rs similarity index 100% rename from crates/domain/or-world-gta6/src/stream_grass.rs rename to crates/domain/or-world-gta6/src/stream/grass.rs diff --git a/crates/domain/or-world-gta6/src/stream_laid.rs b/crates/domain/or-world-gta6/src/stream/laid.rs similarity index 100% rename from crates/domain/or-world-gta6/src/stream_laid.rs rename to crates/domain/or-world-gta6/src/stream/laid.rs diff --git a/crates/domain/or-world-gta6/src/stream.rs b/crates/domain/or-world-gta6/src/stream/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/stream.rs rename to crates/domain/or-world-gta6/src/stream/mod.rs index 2c9828cde..143145395 100644 --- a/crates/domain/or-world-gta6/src/stream.rs +++ b/crates/domain/or-world-gta6/src/stream/mod.rs @@ -16,19 +16,12 @@ use or_world::streaming::{Extent, Forest, Kind, Level, NodeId, NodeState, View, use crate::index::{Enabled, ModelRef, WorldIndex}; use or_world::pool::Pool; -#[path = "stream_census.rs"] mod census; -#[path = "stream_grass.rs"] mod grass; -#[path = "stream_laid.rs"] mod laid; -#[path = "stream_pick.rs"] pub mod pick; -#[path = "stream_read.rs"] mod read; -#[path = "stream_slod.rs"] pub mod slod; -#[path = "stream_world.rs"] mod world; pub use census::Census; @@ -928,5 +921,4 @@ impl Streamer { } #[cfg(test)] -#[path = "stream_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/stream_pick.rs b/crates/domain/or-world-gta6/src/stream/pick/mod.rs similarity index 99% rename from crates/domain/or-world-gta6/src/stream_pick.rs rename to crates/domain/or-world-gta6/src/stream/pick/mod.rs index f4f7574d5..a4ed62e28 100644 --- a/crates/domain/or-world-gta6/src/stream_pick.rs +++ b/crates/domain/or-world-gta6/src/stream/pick/mod.rs @@ -445,5 +445,4 @@ fn describe( } #[cfg(test)] -#[path = "stream_pick_tests.rs"] mod tests; diff --git a/crates/domain/or-world-gta6/src/stream_pick_tests.rs b/crates/domain/or-world-gta6/src/stream/pick/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/stream_pick_tests.rs rename to crates/domain/or-world-gta6/src/stream/pick/tests.rs diff --git a/crates/domain/or-world-gta6/src/stream_read.rs b/crates/domain/or-world-gta6/src/stream/read.rs similarity index 100% rename from crates/domain/or-world-gta6/src/stream_read.rs rename to crates/domain/or-world-gta6/src/stream/read.rs diff --git a/crates/domain/or-world-gta6/src/stream_slod.rs b/crates/domain/or-world-gta6/src/stream/slod.rs similarity index 100% rename from crates/domain/or-world-gta6/src/stream_slod.rs rename to crates/domain/or-world-gta6/src/stream/slod.rs diff --git a/crates/domain/or-world-gta6/src/stream_tests.rs b/crates/domain/or-world-gta6/src/stream/tests.rs similarity index 100% rename from crates/domain/or-world-gta6/src/stream_tests.rs rename to crates/domain/or-world-gta6/src/stream/tests.rs diff --git a/crates/domain/or-world-gta6/src/stream_world.rs b/crates/domain/or-world-gta6/src/stream/world.rs similarity index 100% rename from crates/domain/or-world-gta6/src/stream_world.rs rename to crates/domain/or-world-gta6/src/stream/world.rs diff --git a/crates/foundation/or-test-support/tests/no_test_leaves_a_folder_in_the_temporary_folder.rs b/crates/foundation/or-test-support/tests/no_test_leaves_a_folder_in_the_temporary_folder.rs index 7d7382d13..8a0ea300f 100644 --- a/crates/foundation/or-test-support/tests/no_test_leaves_a_folder_in_the_temporary_folder.rs +++ b/crates/foundation/or-test-support/tests/no_test_leaves_a_folder_in_the_temporary_folder.rs @@ -22,7 +22,7 @@ const ALLOWED: &[(&str, &str)] = &[ "the editor's own staging folder, which a self-check and a test build keep out of", ), ( - "src/state/prefs.rs", + "src/state/prefs/mod.rs", "the folder a self-check names for its scratch, which the run removes however it ends", ), ( @@ -46,15 +46,15 @@ const ALLOWED: &[(&str, &str)] = &[ "the scratch folder of a photograph run, which its drop guard removes however the run ends", ), ( - "src/state/test_scratch.rs", + "src/state/tests/test_scratch.rs", "the one scratch folder of a test process, removed as the process ends", ), ( - "src/state/a_self_check_keeps_to_itself.rs", + "src/state/tests/a_self_check_keeps_to_itself.rs", "lists the editor's staging folder to see that a self-check added nothing to it", ), ( - "src/state/a_plugin_asks_before_it_runs.rs", + "src/state/tests/a_plugin_asks_before_it_runs.rs", "names a document's path outside every install and writes nothing there", ), ( diff --git a/crates/io/or-io/src/gta6/accel/build.rs b/crates/io/or-io/src/gta6/accel/build/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/accel/build.rs rename to crates/io/or-io/src/gta6/accel/build/mod.rs index a334320e2..2b463b3b2 100644 --- a/crates/io/or-io/src/gta6/accel/build.rs +++ b/crates/io/or-io/src/gta6/accel/build/mod.rs @@ -593,5 +593,4 @@ pub(super) fn instance_node(instance: &Instance, index: usize) -> Result u32 { } #[cfg(test)] -#[path = "columns_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/anim/columns_tests.rs b/crates/io/or-io/src/gta6/anim/columns/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/columns_tests.rs rename to crates/io/or-io/src/gta6/anim/columns/tests.rs diff --git a/crates/io/or-io/src/gta6/anim/databases.rs b/crates/io/or-io/src/gta6/anim/databases/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/anim/databases.rs rename to crates/io/or-io/src/gta6/anim/databases/mod.rs index 96928e7fd..bf4e4c199 100644 --- a/crates/io/or-io/src/gta6/anim/databases.rs +++ b/crates/io/or-io/src/gta6/anim/databases/mod.rs @@ -273,5 +273,4 @@ fn volume(v: &[[f32; 3]; 4]) -> f64 { } #[cfg(test)] -#[path = "databases_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/anim/databases_tests.rs b/crates/io/or-io/src/gta6/anim/databases/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/databases_tests.rs rename to crates/io/or-io/src/gta6/anim/databases/tests.rs diff --git a/crates/io/or-io/src/gta6/anim/expressions.rs b/crates/io/or-io/src/gta6/anim/expressions/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/anim/expressions.rs rename to crates/io/or-io/src/gta6/anim/expressions/mod.rs index e1a514c9f..4e0703b02 100644 --- a/crates/io/or-io/src/gta6/anim/expressions.rs +++ b/crates/io/or-io/src/gta6/anim/expressions/mod.rs @@ -411,5 +411,4 @@ impl Section<'_> { } #[cfg(test)] -#[path = "expressions_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/anim/expressions_tests.rs b/crates/io/or-io/src/gta6/anim/expressions/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/expressions_tests.rs rename to crates/io/or-io/src/gta6/anim/expressions/tests.rs diff --git a/crates/io/or-io/src/gta6/anim/expressions_group_d.rs b/crates/io/or-io/src/gta6/anim/expressions_layout/group_d/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/anim/expressions_group_d.rs rename to crates/io/or-io/src/gta6/anim/expressions_layout/group_d/mod.rs index 7b1520762..c6f35959c 100644 --- a/crates/io/or-io/src/gta6/anim/expressions_group_d.rs +++ b/crates/io/or-io/src/gta6/anim/expressions_layout/group_d/mod.rs @@ -112,5 +112,4 @@ pub(super) fn remove_facial_output( } #[cfg(test)] -#[path = "expressions_group_d_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/anim/expressions_group_d_tests.rs b/crates/io/or-io/src/gta6/anim/expressions_layout/group_d/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/expressions_group_d_tests.rs rename to crates/io/or-io/src/gta6/anim/expressions_layout/group_d/tests.rs diff --git a/crates/io/or-io/src/gta6/anim/expressions_layout.rs b/crates/io/or-io/src/gta6/anim/expressions_layout/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/anim/expressions_layout.rs rename to crates/io/or-io/src/gta6/anim/expressions_layout/mod.rs index 4ac8a630b..eadd1ec18 100644 --- a/crates/io/or-io/src/gta6/anim/expressions_layout.rs +++ b/crates/io/or-io/src/gta6/anim/expressions_layout/mod.rs @@ -10,7 +10,6 @@ use super::expressions::{ }; use super::AnimError; -#[path = "expressions_group_d.rs"] mod group_d; pub use group_d::offered_facial_outputs; @@ -517,9 +516,7 @@ pub fn write_edited_expressions( } #[cfg(test)] -#[path = "expressions_layout_tests.rs"] mod tests; #[cfg(test)] -#[path = "expressions_shape_tests.rs"] mod shape_tests; diff --git a/crates/io/or-io/src/gta6/anim/expressions_shape_tests.rs b/crates/io/or-io/src/gta6/anim/expressions_layout/shape_tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/expressions_shape_tests.rs rename to crates/io/or-io/src/gta6/anim/expressions_layout/shape_tests.rs diff --git a/crates/io/or-io/src/gta6/anim/expressions_layout_tests.rs b/crates/io/or-io/src/gta6/anim/expressions_layout/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/expressions_layout_tests.rs rename to crates/io/or-io/src/gta6/anim/expressions_layout/tests.rs diff --git a/crates/io/or-io/src/gta6/anim/matcher_levels.rs b/crates/io/or-io/src/gta6/anim/matcher/levels.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/matcher_levels.rs rename to crates/io/or-io/src/gta6/anim/matcher/levels.rs diff --git a/crates/io/or-io/src/gta6/anim/matcher.rs b/crates/io/or-io/src/gta6/anim/matcher/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/anim/matcher.rs rename to crates/io/or-io/src/gta6/anim/matcher/mod.rs index 613313c58..d500085b9 100644 --- a/crates/io/or-io/src/gta6/anim/matcher.rs +++ b/crates/io/or-io/src/gta6/anim/matcher/mod.rs @@ -703,9 +703,7 @@ impl Section<'_> { } } -#[path = "matcher_levels.rs"] mod levels; #[cfg(test)] -#[path = "matcher_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/anim/matcher_tests.rs b/crates/io/or-io/src/gta6/anim/matcher/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/matcher_tests.rs rename to crates/io/or-io/src/gta6/anim/matcher/tests.rs diff --git a/crates/io/or-io/src/gta6/anim/metadata.rs b/crates/io/or-io/src/gta6/anim/metadata/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/anim/metadata.rs rename to crates/io/or-io/src/gta6/anim/metadata/mod.rs index 3d9ff2ff6..de8925706 100644 --- a/crates/io/or-io/src/gta6/anim/metadata.rs +++ b/crates/io/or-io/src/gta6/anim/metadata/mod.rs @@ -628,5 +628,4 @@ fn object( } #[cfg(test)] -#[path = "metadata_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/anim/metadata_tests.rs b/crates/io/or-io/src/gta6/anim/metadata/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/metadata_tests.rs rename to crates/io/or-io/src/gta6/anim/metadata/tests.rs diff --git a/crates/io/or-io/src/gta6/anim/mod.rs b/crates/io/or-io/src/gta6/anim/mod.rs index ed40b9c8e..743446927 100644 --- a/crates/io/or-io/src/gta6/anim/mod.rs +++ b/crates/io/or-io/src/gta6/anim/mod.rs @@ -1571,5 +1571,4 @@ fn delta_ranges( } #[cfg(test)] -#[path = "anim_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/anim/clip_signature_tests.rs b/crates/io/or-io/src/gta6/anim/tests/clip_signature.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/clip_signature_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/clip_signature.rs diff --git a/crates/io/or-io/src/gta6/anim/clip_signature_build_tests.rs b/crates/io/or-io/src/gta6/anim/tests/clip_signature_build/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/anim/clip_signature_build_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/clip_signature_build/mod.rs index fbc6beeca..0ea07649b 100644 --- a/crates/io/or-io/src/gta6/anim/clip_signature_build_tests.rs +++ b/crates/io/or-io/src/gta6/anim/tests/clip_signature_build/mod.rs @@ -262,5 +262,4 @@ fn the_clips_of_a_sample_of_the_build_state_the_signature_their_fields_give() { assert!(t.edited > 0, "no clip of the sample took an edit"); } -#[path = "replace_build_tests.rs"] mod replace; diff --git a/crates/io/or-io/src/gta6/anim/replace_build_tests.rs b/crates/io/or-io/src/gta6/anim/tests/clip_signature_build/replace.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/replace_build_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/clip_signature_build/replace.rs diff --git a/crates/io/or-io/src/gta6/anim/anim_tests.rs b/crates/io/or-io/src/gta6/anim/tests/mod.rs similarity index 98% rename from crates/io/or-io/src/gta6/anim/anim_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/mod.rs index 653435d1a..061943edc 100644 --- a/crates/io/or-io/src/gta6/anim/anim_tests.rs +++ b/crates/io/or-io/src/gta6/anim/tests/mod.rs @@ -896,23 +896,13 @@ fn motion_at(bytes: &[u8], name: &str) -> usize { } pointer_at(bytes, entry + 8) } -#[path = "clip_signature_tests.rs"] mod clip_signature; -#[path = "clip_signature_build_tests.rs"] mod clip_signature_build; -#[path = "motion_loop_tests.rs"] mod motion_loop; -#[path = "write_tests.rs"] mod write; -#[path = "write_derived_and_grown_tests.rs"] mod write_derived_and_grown; -#[path = "write_edit_tests.rs"] mod write_edit; -#[path = "write_in_extent_tests.rs"] mod write_in_extent; -#[path = "write_mapped_tests.rs"] mod write_mapped; -#[path = "write_relayout_tests.rs"] mod write_relayout; -#[path = "write_replace_tests.rs"] mod write_replace; diff --git a/crates/io/or-io/src/gta6/anim/motion_loop_tests.rs b/crates/io/or-io/src/gta6/anim/tests/motion_loop/mod.rs similarity index 97% rename from crates/io/or-io/src/gta6/anim/motion_loop_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/motion_loop/mod.rs index c5da64592..3cf8d551a 100644 --- a/crates/io/or-io/src/gta6/anim/motion_loop_tests.rs +++ b/crates/io/or-io/src/gta6/anim/tests/motion_loop/mod.rs @@ -58,5 +58,4 @@ fn a_motion_s_loop_is_set_and_cleared_in_one_bit_and_the_section_keeps_its_lengt assert_eq!(section(&cleared), &b.0[..]); } -#[path = "motion_loop_build_tests.rs"] mod on_the_build; diff --git a/crates/io/or-io/src/gta6/anim/motion_loop_build_tests.rs b/crates/io/or-io/src/gta6/anim/tests/motion_loop/on_the_build.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/motion_loop_build_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/motion_loop/on_the_build.rs diff --git a/crates/io/or-io/src/gta6/anim/write_tests.rs b/crates/io/or-io/src/gta6/anim/tests/write.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/write_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/write.rs diff --git a/crates/io/or-io/src/gta6/anim/write_derived_and_grown_tests.rs b/crates/io/or-io/src/gta6/anim/tests/write_derived_and_grown.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/write_derived_and_grown_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/write_derived_and_grown.rs diff --git a/crates/io/or-io/src/gta6/anim/write_edit_tests.rs b/crates/io/or-io/src/gta6/anim/tests/write_edit.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/write_edit_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/write_edit.rs diff --git a/crates/io/or-io/src/gta6/anim/write_in_extent_tests.rs b/crates/io/or-io/src/gta6/anim/tests/write_in_extent.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/write_in_extent_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/write_in_extent.rs diff --git a/crates/io/or-io/src/gta6/anim/write_mapped_tests.rs b/crates/io/or-io/src/gta6/anim/tests/write_mapped.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/write_mapped_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/write_mapped.rs diff --git a/crates/io/or-io/src/gta6/anim/write_relayout_tests.rs b/crates/io/or-io/src/gta6/anim/tests/write_relayout.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/write_relayout_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/write_relayout.rs diff --git a/crates/io/or-io/src/gta6/anim/write_replace_tests.rs b/crates/io/or-io/src/gta6/anim/tests/write_replace.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/write_replace_tests.rs rename to crates/io/or-io/src/gta6/anim/tests/write_replace.rs diff --git a/crates/io/or-io/src/gta6/anim/write.rs b/crates/io/or-io/src/gta6/anim/write/mod.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim/write.rs rename to crates/io/or-io/src/gta6/anim/write/mod.rs diff --git a/crates/io/or-io/src/gta6/anim_scene.rs b/crates/io/or-io/src/gta6/anim_scene/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/anim_scene.rs rename to crates/io/or-io/src/gta6/anim_scene/mod.rs index a5ddce7dc..fcc34706e 100644 --- a/crates/io/or-io/src/gta6/anim_scene.rs +++ b/crates/io/or-io/src/gta6/anim_scene/mod.rs @@ -402,5 +402,4 @@ fn read_event(n: &Names, event: &MetaInstance) -> Event { } #[cfg(test)] -#[path = "anim_scene_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/anim_scene_tests.rs b/crates/io/or-io/src/gta6/anim_scene/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/anim_scene_tests.rs rename to crates/io/or-io/src/gta6/anim_scene/tests.rs diff --git a/crates/io/or-io/src/gta6/audio_data.rs b/crates/io/or-io/src/gta6/audio/data/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/audio_data.rs rename to crates/io/or-io/src/gta6/audio/data/mod.rs index 55d2d8e79..95fc024d0 100644 --- a/crates/io/or-io/src/gta6/audio_data.rs +++ b/crates/io/or-io/src/gta6/audio/data/mod.rs @@ -560,5 +560,4 @@ fn curve( } #[cfg(test)] -#[path = "audio_data_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/audio_data_tests.rs b/crates/io/or-io/src/gta6/audio/data/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/audio_data_tests.rs rename to crates/io/or-io/src/gta6/audio/data/tests.rs diff --git a/crates/io/or-io/src/gta6/audio_layouts.txt b/crates/io/or-io/src/gta6/audio/links/audio_layouts.txt similarity index 100% rename from crates/io/or-io/src/gta6/audio_layouts.txt rename to crates/io/or-io/src/gta6/audio/links/audio_layouts.txt diff --git a/crates/io/or-io/src/gta6/audio_value_types.txt b/crates/io/or-io/src/gta6/audio/links/audio_value_types.txt similarity index 100% rename from crates/io/or-io/src/gta6/audio_value_types.txt rename to crates/io/or-io/src/gta6/audio/links/audio_value_types.txt diff --git a/crates/io/or-io/src/gta6/audio_links.rs b/crates/io/or-io/src/gta6/audio/links/mod.rs similarity index 98% rename from crates/io/or-io/src/gta6/audio_links.rs rename to crates/io/or-io/src/gta6/audio/links/mod.rs index 1f0c2c267..b92e27d13 100644 --- a/crates/io/or-io/src/gta6/audio_links.rs +++ b/crates/io/or-io/src/gta6/audio/links/mod.rs @@ -5,9 +5,8 @@ use std::collections::{BTreeMap, BTreeSet}; use std::hash::{DefaultHasher, Hash, Hasher}; -use super::audio_data::{AudioData, AudioDataError, AudioDataKind, AudioItem}; +use super::data::{AudioData, AudioDataError, AudioDataKind, AudioItem}; -#[path = "audio_tables.rs"] mod tables; pub use tables::{SlotRole, SlotValue, TableField, TableItem, TableValue}; @@ -328,7 +327,7 @@ pub fn config_names( "the pool offset {at} of key {key:#010X} starts no name" )) })?; - if super::hash::name_hash32(name) != key { + if crate::gta6::hash::name_hash32(name) != key { return Err(bad(format!( "the pool name at {at} does not hash to its item's key {key:#010X}" ))); @@ -409,5 +408,4 @@ impl WaveIndex { } #[cfg(test)] -#[path = "audio_links_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/audio_tables.rs b/crates/io/or-io/src/gta6/audio/links/tables.rs similarity index 99% rename from crates/io/or-io/src/gta6/audio_tables.rs rename to crates/io/or-io/src/gta6/audio/links/tables.rs index ffe191213..4c0263a13 100644 --- a/crates/io/or-io/src/gta6/audio_tables.rs +++ b/crates/io/or-io/src/gta6/audio/links/tables.rs @@ -326,7 +326,7 @@ impl ValueType { /// The data offset of the item `key` names in `data`'s index, which its order sorts. fn item_offset(data: &AudioData, key: u32) -> Option { - use crate::gta6::audio_data::index_order; + use super::super::data::index_order; let i = (data.index) .binary_search_by_key(&index_order(key), |e| index_order(e.0)) .ok()?; diff --git a/crates/io/or-io/src/gta6/audio_links_tests.rs b/crates/io/or-io/src/gta6/audio/links/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/audio_links_tests.rs rename to crates/io/or-io/src/gta6/audio/links/tests.rs diff --git a/crates/io/or-io/src/gta6/audio/mod.rs b/crates/io/or-io/src/gta6/audio/mod.rs new file mode 100644 index 000000000..a6a151678 --- /dev/null +++ b/crates/io/or-io/src/gta6/audio/mod.rs @@ -0,0 +1,5 @@ +//! GTA VI's audio container data, cross-reference links and radio station metadata. + +pub mod data; +pub mod links; +pub mod radio; diff --git a/crates/io/or-io/src/gta6/audio_radio.rs b/crates/io/or-io/src/gta6/audio/radio/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/audio_radio.rs rename to crates/io/or-io/src/gta6/audio/radio/mod.rs index 4fd11d734..79c8f7773 100644 --- a/crates/io/or-io/src/gta6/audio_radio.rs +++ b/crates/io/or-io/src/gta6/audio/radio/mod.rs @@ -10,9 +10,9 @@ use std::collections::{BTreeMap, BTreeSet}; -use super::audio_data::{AudioData, AudioDataKind, AudioItem}; -use super::audio_links::{layout, ItemLayout}; -use super::hash::name_hash32; +use super::data::{AudioData, AudioDataKind, AudioItem}; +use super::links::{layout, ItemLayout}; +use crate::gta6::hash::name_hash32; /// The class of a music body's station items. pub const STATION_CLASS: u8 = 16; @@ -523,5 +523,4 @@ impl Station { } #[cfg(test)] -#[path = "audio_radio_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/audio_radio_tests.rs b/crates/io/or-io/src/gta6/audio/radio/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/audio_radio_tests.rs rename to crates/io/or-io/src/gta6/audio/radio/tests.rs diff --git a/crates/io/or-io/src/gta6/bcpack/bc6h.rs b/crates/io/or-io/src/gta6/bcpack/bc6h/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/bcpack/bc6h.rs rename to crates/io/or-io/src/gta6/bcpack/bc6h/mod.rs index 770ad5cf1..ac255d5ac 100644 --- a/crates/io/or-io/src/gta6/bcpack/bc6h.rs +++ b/crates/io/or-io/src/gta6/bcpack/bc6h/mod.rs @@ -717,5 +717,4 @@ pub(super) fn blocks( } #[cfg(test)] -#[path = "bc6h_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/bcpack/bc6h_tests.rs b/crates/io/or-io/src/gta6/bcpack/bc6h/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/bcpack/bc6h_tests.rs rename to crates/io/or-io/src/gta6/bcpack/bc6h/tests.rs diff --git a/crates/io/or-io/src/gta6/bcpack/bptc.rs b/crates/io/or-io/src/gta6/bcpack/bptc/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/bcpack/bptc.rs rename to crates/io/or-io/src/gta6/bcpack/bptc/mod.rs index 3e9a72581..4429928b0 100644 --- a/crates/io/or-io/src/gta6/bcpack/bptc.rs +++ b/crates/io/or-io/src/gta6/bcpack/bptc/mod.rs @@ -1063,5 +1063,4 @@ pub(super) fn blocks(lanes: &[Vec], presets: &Presets) -> Result [(u16, u16); 2] { } #[cfg(test)] -#[path = "encode_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/bcpack/encode_bc1.rs b/crates/io/or-io/src/gta6/bcpack/encode/of_bc1.rs similarity index 100% rename from crates/io/or-io/src/gta6/bcpack/encode_bc1.rs rename to crates/io/or-io/src/gta6/bcpack/encode/of_bc1.rs diff --git a/crates/io/or-io/src/gta6/bcpack/encode_bc6h.rs b/crates/io/or-io/src/gta6/bcpack/encode/of_bc6h.rs similarity index 100% rename from crates/io/or-io/src/gta6/bcpack/encode_bc6h.rs rename to crates/io/or-io/src/gta6/bcpack/encode/of_bc6h.rs diff --git a/crates/io/or-io/src/gta6/bcpack/encode_bc7.rs b/crates/io/or-io/src/gta6/bcpack/encode/of_bc7.rs similarity index 100% rename from crates/io/or-io/src/gta6/bcpack/encode_bc7.rs rename to crates/io/or-io/src/gta6/bcpack/encode/of_bc7.rs diff --git a/crates/io/or-io/src/gta6/bcpack/encode_tests.rs b/crates/io/or-io/src/gta6/bcpack/encode/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/bcpack/encode_tests.rs rename to crates/io/or-io/src/gta6/bcpack/encode/tests.rs diff --git a/crates/io/or-io/src/gta6/bcpack/supplied.rs b/crates/io/or-io/src/gta6/bcpack/supplied/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/bcpack/supplied.rs rename to crates/io/or-io/src/gta6/bcpack/supplied/mod.rs index fac393901..8da116e11 100644 --- a/crates/io/or-io/src/gta6/bcpack/supplied.rs +++ b/crates/io/or-io/src/gta6/bcpack/supplied/mod.rs @@ -462,5 +462,4 @@ pub fn read(bytes: &[u8]) -> Result { } #[cfg(any(test, feature = "made-up"))] -#[path = "supplied_tests.rs"] pub(in crate::gta6) mod tests; diff --git a/crates/io/or-io/src/gta6/bcpack/supplied_tests.rs b/crates/io/or-io/src/gta6/bcpack/supplied/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/bcpack/supplied_tests.rs rename to crates/io/or-io/src/gta6/bcpack/supplied/tests.rs diff --git a/crates/io/or-io/src/gta6/dialogue.rs b/crates/io/or-io/src/gta6/dialogue/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/dialogue.rs rename to crates/io/or-io/src/gta6/dialogue/mod.rs index 82c13ce91..c720c927e 100644 --- a/crates/io/or-io/src/gta6/dialogue.rs +++ b/crates/io/or-io/src/gta6/dialogue/mod.rs @@ -218,5 +218,4 @@ impl Dialogue { } #[cfg(test)] -#[path = "dialogue_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/dialogue_tests.rs b/crates/io/or-io/src/gta6/dialogue/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/dialogue_tests.rs rename to crates/io/or-io/src/gta6/dialogue/tests.rs diff --git a/crates/io/or-io/src/gta6/headerless/forest.rs b/crates/io/or-io/src/gta6/headerless/forest/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/forest.rs rename to crates/io/or-io/src/gta6/headerless/forest/mod.rs index bd7faeaf5..9ae4bfd1d 100644 --- a/crates/io/or-io/src/gta6/headerless/forest.rs +++ b/crates/io/or-io/src/gta6/headerless/forest/mod.rs @@ -121,5 +121,4 @@ pub fn read_object_trees(body: &[u8]) -> Result { } #[cfg(test)] -#[path = "forest_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/headerless/forest_tests.rs b/crates/io/or-io/src/gta6/headerless/forest/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/forest_tests.rs rename to crates/io/or-io/src/gta6/headerless/forest/tests.rs diff --git a/crates/io/or-io/src/gta6/headerless/fragment_records.rs b/crates/io/or-io/src/gta6/headerless/fragment_records/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/fragment_records.rs rename to crates/io/or-io/src/gta6/headerless/fragment_records/mod.rs index 8e61d707c..9bc840891 100644 --- a/crates/io/or-io/src/gta6/headerless/fragment_records.rs +++ b/crates/io/or-io/src/gta6/headerless/fragment_records/mod.rs @@ -617,5 +617,4 @@ fn wheels(groups: &[FragmentGroup], bones: &[Bone]) -> Result> { } #[cfg(test)] -#[path = "fragment_records_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/headerless/fragment_records_tests.rs b/crates/io/or-io/src/gta6/headerless/fragment_records/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/fragment_records_tests.rs rename to crates/io/or-io/src/gta6/headerless/fragment_records/tests.rs diff --git a/crates/io/or-io/src/gta6/headerless/mod.rs b/crates/io/or-io/src/gta6/headerless/mod.rs index 016fc5c98..ec4b38d5f 100644 --- a/crates/io/or-io/src/gta6/headerless/mod.rs +++ b/crates/io/or-io/src/gta6/headerless/mod.rs @@ -23,32 +23,6 @@ mod streams; mod surfaces; mod texture; mod write; -mod write_bone_names; -mod write_bound_grow; -mod write_bound_reshape; -mod write_bound_runs; -mod write_bound_values; -mod write_bound_vertex; -mod write_bvh; -mod write_dictionary; -mod write_dictionary_entries; -mod write_dictionary_textures; -mod write_embedded; -mod write_embedded_repack; -mod write_filter_tracks; -mod write_filters; -mod write_fragment_child; -mod write_geometry; -mod write_geometry_replace; -mod write_material; -mod write_navmesh; -mod write_navmesh_delete; -mod write_navmesh_links; -mod write_navmesh_side; -mod write_palette; -mod write_physics; -mod write_skeleton; -mod write_volume; pub use accel_root::{read_accel_root, AccelHead, AccelRecord, AccelRoot}; pub use bound::{ @@ -111,55 +85,49 @@ pub use streams::{ }; pub use surfaces::Surface; pub use texture::DictionaryTexture; -pub use write::{write_shaders, write_texture}; -pub use write_bone_names::{bone_name_holds, rename_bones, BoneNameError}; -pub use write_bound_grow::{ +pub use write::stated_words; +pub use write::write_embedded_texture; +pub use write::write_volume_texture; +pub use write::{ add_bound_primitive, add_bound_vertex, copy_bound_child, delete_bound_child, delete_bound_primitive, delete_bound_vertex, fit_composite_box, reshape_bound_body, retyped_bound_child, write_retyped, BoundGrowError, BoundHolder, BoundReshape, }; -pub use write_bound_reshape::{edge_byte, rewire_triangle}; -pub use write_bound_vertex::{vertex_move_holds, write_bound_vertices}; -pub use write_dictionary::{ - read_dictionary_model, write_dictionary, DictionaryModel, DictionaryWriteError, ModelTexture, +pub use write::{bind_positions, rebox_bind_pose}; +pub use write::{bone_name_holds, rename_bones, BoneNameError}; +pub use write::{ + bound_placement_holds, write_bound, write_drawable_bound, write_fragment, write_fragment_bound, + write_polygon_flags, }; -pub use write_dictionary_entries::{copy_dictionary_entry, entry_key, remove_dictionary_entry}; -pub use write_dictionary_textures::{write_dictionary_textures, HeldTexture, TexturePlanError}; -pub use write_embedded::write_embedded_texture; -pub use write_embedded_repack::{ - embed_texture, key_word, reshape_embedded_texture, unembed_texture, EmbedError, +pub use write::{copy_dictionary_entry, entry_key, remove_dictionary_entry}; +pub use write::{cut_edges, links_into, polygon_cut, PolygonCut}; +pub use write::{ + delete_polygon, deletion, disable_polygon, disabling, polygon_deleted, NavDeleteError, + NavRebuild, }; -pub use write_filter_tracks::{write_filter_tracks, write_record_bones, ElementsError}; -pub use write_filters::{write_filter_weights, write_record_values}; -pub use write_fragment_child::{ +pub use write::{edge_byte, rewire_triangle}; +pub use write::{embed_texture, key_word, reshape_embedded_texture, unembed_texture, EmbedError}; +pub use write::{ fragment_child_local_in, fragment_child_place, place_fragment_child, regroup_fragment_child, write_fragment_level, }; -pub use write_geometry::{bind_positions, rebox_bind_pose}; -pub use write_geometry::{ - write_geometry, GeometryAt, GeometryEdit, GeometryWriteError, GeometryWritten, +pub use write::{ + read_dictionary_model, write_dictionary, DictionaryModel, DictionaryWriteError, ModelTexture, }; -pub use write_geometry::{write_geometry_cut, GeometryCut}; -pub use write_geometry_replace::{ +pub use write::{rebind_under, write_skeleton}; +pub use write::{relinked, with_links, write_links}; +pub use write::{ replace_geometry, streamed_geometry, GeometryReplaceError, GeometryReplaced, Streamed, }; -pub use write_material::stated_words; -pub use write_material::{ - shader_layout_holds, write_materials, write_materials_with, MaterialLayoutError, -}; -pub use write_navmesh::{cut_edges, links_into, polygon_cut, PolygonCut}; -pub use write_navmesh_delete::{ - delete_polygon, deletion, disable_polygon, disabling, polygon_deleted, NavDeleteError, - NavRebuild, -}; -pub use write_navmesh_links::{relinked, with_links, write_links}; -pub use write_palette::{write_palette, PaletteAdd}; -pub use write_physics::{ - bound_placement_holds, write_bound, write_drawable_bound, write_fragment, write_fragment_bound, - write_polygon_flags, -}; -pub use write_skeleton::{rebind_under, write_skeleton}; -pub use write_volume::write_volume_texture; +pub use write::{shader_layout_holds, write_materials, write_materials_with, MaterialLayoutError}; +pub use write::{vertex_move_holds, write_bound_vertices}; +pub use write::{write_dictionary_textures, HeldTexture, TexturePlanError}; +pub use write::{write_filter_tracks, write_record_bones, ElementsError}; +pub use write::{write_filter_weights, write_record_values}; +pub use write::{write_geometry, GeometryAt, GeometryEdit, GeometryWriteError, GeometryWritten}; +pub use write::{write_geometry_cut, GeometryCut}; +pub use write::{write_palette, PaletteAdd}; +pub use write::{write_shaders, write_texture}; use crate::container::rpf::{Rpf9Role, Rpf9Signature}; diff --git a/crates/io/or-io/src/gta6/headerless/particles_bits.rs b/crates/io/or-io/src/gta6/headerless/particles/bits.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_bits.rs rename to crates/io/or-io/src/gta6/headerless/particles/bits.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_colour.rs b/crates/io/or-io/src/gta6/headerless/particles/colour_word.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_colour.rs rename to crates/io/or-io/src/gta6/headerless/particles/colour_word.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_copy.rs b/crates/io/or-io/src/gta6/headerless/particles/copier.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_copy.rs rename to crates/io/or-io/src/gta6/headerless/particles/copier.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_event_object.rs b/crates/io/or-io/src/gta6/headerless/particles/dup/event_object.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_event_object.rs rename to crates/io/or-io/src/gta6/headerless/particles/dup/event_object.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_dup.rs b/crates/io/or-io/src/gta6/headerless/particles/dup/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/particles_dup.rs rename to crates/io/or-io/src/gta6/headerless/particles/dup/mod.rs index 3e4e89994..bd437d9ca 100644 --- a/crates/io/or-io/src/gta6/headerless/particles_dup.rs +++ b/crates/io/or-io/src/gta6/headerless/particles/dup/mod.rs @@ -584,5 +584,4 @@ fn own_buffers(s: &Rpf9Sections, from: &ParticleRule, to: &ParticleRule) -> Resu Ok(()) } -#[path = "particles_event_object.rs"] pub(super) mod event_object; diff --git a/crates/io/or-io/src/gta6/headerless/particles_fields.rs b/crates/io/or-io/src/gta6/headerless/particles/fields_word.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_fields.rs rename to crates/io/or-io/src/gta6/headerless/particles/fields_word.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_gpu.rs b/crates/io/or-io/src/gta6/headerless/particles/gpu.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_gpu.rs rename to crates/io/or-io/src/gta6/headerless/particles/gpu.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_keys.rs b/crates/io/or-io/src/gta6/headerless/particles/keys.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_keys.rs rename to crates/io/or-io/src/gta6/headerless/particles/keys.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles.rs b/crates/io/or-io/src/gta6/headerless/particles/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/particles.rs rename to crates/io/or-io/src/gta6/headerless/particles/mod.rs index 65defea35..931354051 100644 --- a/crates/io/or-io/src/gta6/headerless/particles.rs +++ b/crates/io/or-io/src/gta6/headerless/particles/mod.rs @@ -1143,51 +1143,40 @@ fn behaviour(v: &Bytes, at: usize, next: usize) -> Result { }) } -#[path = "particles_open.rs"] mod parts; pub use parts::{ BehaviourFields, DiffuseMode, EvolvedKeyframe, LightingMode, ProjectionMode, ShaderSwitch, Shading, COLOUR_RGBA_KFPS, }; -#[path = "particles_write.rs"] mod writer; pub use writer::write_particle_effects; -#[path = "particles_remove.rs"] mod remover; pub use remover::{remove_from_particle_effects, ParticleRemovals}; -#[path = "particles_keys.rs"] mod keys; pub use keys::{add_particle_keys, ParticleKeysError}; -#[path = "particles_copy.rs"] mod copier; pub use copier::duplicate_particle_effect; -#[path = "particles_dup.rs"] mod dup; pub use dup::{ copy_particle_behaviour, duplicate_particle_emitter, duplicate_particle_event, duplicate_particle_rule, }; -#[path = "particles_gpu.rs"] mod gpu; pub use gpu::{read_particle_gpu_buffers, read_particle_gpu_tables, GpuBuffer, GpuTables}; -#[path = "particles_bits.rs"] mod bits; pub use bits::{class_of_bit, ClassNamedBy}; -#[path = "particles_colour.rs"] mod colour_word; -#[path = "particles_fields.rs"] mod fields_word; -#[path = "particles_tables.rs"] mod tables; pub use tables::{ bake_particle_tables, read_particle_curves, write_particle_curves, ParticleCurve, @@ -1195,5 +1184,4 @@ pub use tables::{ }; #[cfg(test)] -#[path = "particles_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/headerless/particles_open.rs b/crates/io/or-io/src/gta6/headerless/particles/parts.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_open.rs rename to crates/io/or-io/src/gta6/headerless/particles/parts.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_remove.rs b/crates/io/or-io/src/gta6/headerless/particles/remover.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_remove.rs rename to crates/io/or-io/src/gta6/headerless/particles/remover.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_tables.rs b/crates/io/or-io/src/gta6/headerless/particles/tables.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_tables.rs rename to crates/io/or-io/src/gta6/headerless/particles/tables.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_copy_tests.rs b/crates/io/or-io/src/gta6/headerless/particles/tests/copied.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_copy_tests.rs rename to crates/io/or-io/src/gta6/headerless/particles/tests/copied.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_event_object_tests.rs b/crates/io/or-io/src/gta6/headerless/particles/tests/duplicated/event_object.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_event_object_tests.rs rename to crates/io/or-io/src/gta6/headerless/particles/tests/duplicated/event_object.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_dup_tests.rs b/crates/io/or-io/src/gta6/headerless/particles/tests/duplicated/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/particles_dup_tests.rs rename to crates/io/or-io/src/gta6/headerless/particles/tests/duplicated/mod.rs index c799b447f..26d73789d 100644 --- a/crates/io/or-io/src/gta6/headerless/particles_dup_tests.rs +++ b/crates/io/or-io/src/gta6/headerless/particles/tests/duplicated/mod.rs @@ -208,5 +208,4 @@ fn a_duplicated_rules_curves_are_its_own_and_an_edit_leaves_the_source() { assert_eq!(read(&s, &src).expect("the source still reads"), curves); } -#[path = "particles_event_object_tests.rs"] mod event_object; diff --git a/crates/io/or-io/src/gta6/headerless/particles_keys_tests.rs b/crates/io/or-io/src/gta6/headerless/particles/tests/keys_added.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_keys_tests.rs rename to crates/io/or-io/src/gta6/headerless/particles/tests/keys_added.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_tests.rs b/crates/io/or-io/src/gta6/headerless/particles/tests/mod.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/particles_tests.rs rename to crates/io/or-io/src/gta6/headerless/particles/tests/mod.rs index d028994bb..2b26700b0 100644 --- a/crates/io/or-io/src/gta6/headerless/particles_tests.rs +++ b/crates/io/or-io/src/gta6/headerless/particles/tests/mod.rs @@ -398,17 +398,12 @@ fn a_particle_list_edit_that_would_move_or_is_not_written_is_refused_and_writes_ assert!(refused(&|l| l.emitters[0].kfps[0].entries[1].time[0] = -1.0)); } -#[path = "particles_open_tests.rs"] mod open; -#[path = "particles_remove_tests.rs"] mod remove; -#[path = "particles_keys_tests.rs"] mod keys_added; -#[path = "particles_copy_tests.rs"] mod copied; -#[path = "particles_dup_tests.rs"] mod duplicated; diff --git a/crates/io/or-io/src/gta6/headerless/particles_open_tests.rs b/crates/io/or-io/src/gta6/headerless/particles/tests/open.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_open_tests.rs rename to crates/io/or-io/src/gta6/headerless/particles/tests/open.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_remove_tests.rs b/crates/io/or-io/src/gta6/headerless/particles/tests/remove.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_remove_tests.rs rename to crates/io/or-io/src/gta6/headerless/particles/tests/remove.rs diff --git a/crates/io/or-io/src/gta6/headerless/particles_write.rs b/crates/io/or-io/src/gta6/headerless/particles/writer.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/particles_write.rs rename to crates/io/or-io/src/gta6/headerless/particles/writer.rs diff --git a/crates/io/or-io/src/gta6/headerless/small.rs b/crates/io/or-io/src/gta6/headerless/small/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/small.rs rename to crates/io/or-io/src/gta6/headerless/small/mod.rs index dad354a40..c1cb34c3e 100644 --- a/crates/io/or-io/src/gta6/headerless/small.rs +++ b/crates/io/or-io/src/gta6/headerless/small/mod.rs @@ -346,5 +346,4 @@ pub fn read_offset_table(body: &[u8]) -> Result { } #[cfg(test)] -#[path = "small_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/headerless/small_tests.rs b/crates/io/or-io/src/gta6/headerless/small/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/small_tests.rs rename to crates/io/or-io/src/gta6/headerless/small/tests.rs diff --git a/crates/io/or-io/src/gta6/headerless/tests/bound.rs b/crates/io/or-io/src/gta6/headerless/tests/bound/mod.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/tests/bound.rs rename to crates/io/or-io/src/gta6/headerless/tests/bound/mod.rs index c3cae1734..ea491dc88 100644 --- a/crates/io/or-io/src/gta6/headerless/tests/bound.rs +++ b/crates/io/or-io/src/gta6/headerless/tests/bound/mod.rs @@ -153,11 +153,8 @@ fn a_child_s_material_and_shape_and_a_polygon_s_material_write_in_place() { )); } -#[path = "write_bound_vertex.rs"] mod write_bound_vertex; -#[path = "write_bound_reshape.rs"] mod write_bound_reshape; -#[path = "write_bound_grow.rs"] mod write_bound_grow; diff --git a/crates/io/or-io/src/gta6/headerless/tests/write_bound_grow.rs b/crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_grow/mod.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/tests/write_bound_grow.rs rename to crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_grow/mod.rs index 7c8c39cf6..9527725d6 100644 --- a/crates/io/or-io/src/gta6/headerless/tests/write_bound_grow.rs +++ b/crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_grow/mod.rs @@ -173,8 +173,6 @@ fn an_edit_that_lays_out_bytes_in_a_body_with_no_block_map_is_refused_and_change ); } -#[path = "write_bound_runs.rs"] mod write_bound_runs; -#[path = "write_bound_plain_copy.rs"] mod write_bound_plain_copy; diff --git a/crates/io/or-io/src/gta6/headerless/tests/write_bound_plain_copy.rs b/crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_grow/write_bound_plain_copy.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/tests/write_bound_plain_copy.rs rename to crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_grow/write_bound_plain_copy.rs diff --git a/crates/io/or-io/src/gta6/headerless/tests/write_bound_runs.rs b/crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_grow/write_bound_runs.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/tests/write_bound_runs.rs rename to crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_grow/write_bound_runs.rs index f4a257a02..519d24186 100644 --- a/crates/io/or-io/src/gta6/headerless/tests/write_bound_runs.rs +++ b/crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_grow/write_bound_runs.rs @@ -1,5 +1,5 @@ use super::*; -use crate::gta6::headerless::write_bound_runs::runs_encoded; +use crate::gta6::headerless::write::bound_runs::runs_encoded; /// Two keys whose low halves ascend. const KEYS: [u64; 2] = [0x3F80_0000_0000_0010, 0x4000_0000_0000_0020]; diff --git a/crates/io/or-io/src/gta6/headerless/tests/write_bound_reshape.rs b/crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_reshape.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/tests/write_bound_reshape.rs rename to crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_reshape.rs diff --git a/crates/io/or-io/src/gta6/headerless/tests/write_bound_vertex.rs b/crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_vertex.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/tests/write_bound_vertex.rs rename to crates/io/or-io/src/gta6/headerless/tests/bound/write_bound_vertex.rs diff --git a/crates/io/or-io/src/gta6/headerless/tests/filter_signature_build.rs b/crates/io/or-io/src/gta6/headerless/tests/filter_signature_build.rs index 72ea16e28..ca6c39dee 100644 --- a/crates/io/or-io/src/gta6/headerless/tests/filter_signature_build.rs +++ b/crates/io/or-io/src/gta6/headerless/tests/filter_signature_build.rs @@ -10,7 +10,7 @@ use or_test_support::skip_install; use crate::container::rpf::{ read_rpf9_body, Gta6Mount, GtaViKeys, Rpf9Sections, GTA6_SNAPSHOT_ENV, }; -use crate::gta6::headerless::write_filter_tracks::filter_signatures; +use crate::gta6::headerless::write::filter_tracks::filter_signatures; const BUILD_ENV: &str = "OPENRAGE_GTA6_BUILD"; /// The resource type of a 20-byte row the game registers frame filter dictionaries for. diff --git a/crates/io/or-io/src/gta6/headerless/tests/fragment.rs b/crates/io/or-io/src/gta6/headerless/tests/fragment/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/tests/fragment.rs rename to crates/io/or-io/src/gta6/headerless/tests/fragment/mod.rs index cb60ffa47..a87e1485d 100644 --- a/crates/io/or-io/src/gta6/headerless/tests/fragment.rs +++ b/crates/io/or-io/src/gta6/headerless/tests/fragment/mod.rs @@ -260,5 +260,4 @@ fn a_fragment_s_masses_and_inertia_write_in_place_and_a_moved_child_is_refused() )); } -#[path = "write_fragment_child.rs"] mod write_fragment_child; diff --git a/crates/io/or-io/src/gta6/headerless/tests/write_fragment_child.rs b/crates/io/or-io/src/gta6/headerless/tests/fragment/write_fragment_child.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/tests/write_fragment_child.rs rename to crates/io/or-io/src/gta6/headerless/tests/fragment/write_fragment_child.rs diff --git a/crates/io/or-io/src/gta6/headerless/tests/navmesh.rs b/crates/io/or-io/src/gta6/headerless/tests/navmesh/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/tests/navmesh.rs rename to crates/io/or-io/src/gta6/headerless/tests/navmesh/mod.rs index a35e6c657..7ce28af4e 100644 --- a/crates/io/or-io/src/gta6/headerless/tests/navmesh.rs +++ b/crates/io/or-io/src/gta6/headerless/tests/navmesh/mod.rs @@ -301,8 +301,6 @@ fn a_quadtree_that_loops_is_refused() { )); } -#[path = "write_navmesh.rs"] mod write_navmesh; -#[path = "write_navmesh_delete.rs"] mod write_navmesh_delete; diff --git a/crates/io/or-io/src/gta6/headerless/tests/write_navmesh.rs b/crates/io/or-io/src/gta6/headerless/tests/navmesh/write_navmesh.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/tests/write_navmesh.rs rename to crates/io/or-io/src/gta6/headerless/tests/navmesh/write_navmesh.rs diff --git a/crates/io/or-io/src/gta6/headerless/tests/write_navmesh_delete.rs b/crates/io/or-io/src/gta6/headerless/tests/navmesh/write_navmesh_delete/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/tests/write_navmesh_delete.rs rename to crates/io/or-io/src/gta6/headerless/tests/navmesh/write_navmesh_delete/mod.rs index 2c8617b79..170f7204b 100644 --- a/crates/io/or-io/src/gta6/headerless/tests/write_navmesh_delete.rs +++ b/crates/io/or-io/src/gta6/headerless/tests/navmesh/write_navmesh_delete/mod.rs @@ -265,8 +265,6 @@ fn a_deletion_the_rules_do_not_cover_is_refused_by_name_and_changes_nothing() { delete_polygon(&mut s, 0, &[&same_cell]).expect("another body of the cell itself"); } -#[path = "write_navmesh_links.rs"] mod write_navmesh_links; -#[path = "write_navmesh_no_cell.rs"] mod write_navmesh_no_cell; diff --git a/crates/io/or-io/src/gta6/headerless/tests/write_navmesh_links.rs b/crates/io/or-io/src/gta6/headerless/tests/navmesh/write_navmesh_delete/write_navmesh_links.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/tests/write_navmesh_links.rs rename to crates/io/or-io/src/gta6/headerless/tests/navmesh/write_navmesh_delete/write_navmesh_links.rs diff --git a/crates/io/or-io/src/gta6/headerless/tests/write_navmesh_no_cell.rs b/crates/io/or-io/src/gta6/headerless/tests/navmesh/write_navmesh_delete/write_navmesh_no_cell.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/tests/write_navmesh_no_cell.rs rename to crates/io/or-io/src/gta6/headerless/tests/navmesh/write_navmesh_delete/write_navmesh_no_cell.rs diff --git a/crates/io/or-io/src/gta6/headerless/write_bone_names.rs b/crates/io/or-io/src/gta6/headerless/write/bone_names.rs similarity index 95% rename from crates/io/or-io/src/gta6/headerless/write_bone_names.rs rename to crates/io/or-io/src/gta6/headerless/write/bone_names.rs index 1d10ce23b..01e627ad9 100644 --- a/crates/io/or-io/src/gta6/headerless/write_bone_names.rs +++ b/crates/io/or-io/src/gta6/headerless/write/bone_names.rs @@ -3,10 +3,10 @@ //! +0x1C, which a clip's tracks and a geometry's palette find it by, and its old text stays as bytes //! the record no longer names. -use super::bytes::sections; -use super::skeleton::{owner_at, read_skeleton_of, SkeletonOwner}; -use super::write_material::based; -use super::{HeaderlessError, Result, Skeleton}; +use super::super::bytes::sections; +use super::super::skeleton::{owner_at, read_skeleton_of, SkeletonOwner}; +use super::super::{HeaderlessError, Result, Skeleton}; +use super::material::based; use crate::container::rpf::{grow_section, Rpf9GrowError, Rpf9Section, Rpf9Sections}; /// The base of a virtual-section pointer. diff --git a/crates/io/or-io/src/gta6/headerless/write_bound_grow.rs b/crates/io/or-io/src/gta6/headerless/write/bound_grow.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_bound_grow.rs rename to crates/io/or-io/src/gta6/headerless/write/bound_grow.rs index 42d926871..a9064ba16 100644 --- a/crates/io/or-io/src/gta6/headerless/write_bound_grow.rs +++ b/crates/io/or-io/src/gta6/headerless/write/bound_grow.rs @@ -9,23 +9,21 @@ use std::cmp::Ordering; use crate::container::rpf::{grow_section, Rpf9GrowError, Rpf9Section, Rpf9Sections}; -use super::bound::{bound_at, child_bound, COMPOSITE, GEOMETRY}; -use super::bytes::sections; -use super::write_bound_runs::{ - geometry_copied, own_record_named, runs_after_add, runs_after_delete, +use super::super::bound::{bound_at, child_bound, COMPOSITE, GEOMETRY}; +use super::super::bytes::sections; +use super::super::{ + read_bound, read_drawable, read_drawable_with_bound, Bound, BoundChild, BoundGeometry, + ChildBound, HeaderlessError, Primitive, Result, }; -pub use super::write_bound_values::{ +use super::bound_runs::{geometry_copied, own_record_named, runs_after_add, runs_after_delete}; +pub use super::bound_values::{ add_bound_primitive, add_bound_vertex, copy_bound_child, delete_bound_child, delete_bound_primitive, delete_bound_vertex, fit_composite_box, retyped_bound_child, }; -use super::write_bound_values::{kind, names}; -use super::write_bound_vertex::item_box; -use super::write_bvh::{refit_composite, tree, union, Span, NODE}; -use super::write_physics::{put, put_shape, refuse}; -use super::{ - read_bound, read_drawable, read_drawable_with_bound, Bound, BoundChild, BoundGeometry, - ChildBound, HeaderlessError, Primitive, Result, -}; +use super::bound_values::{kind, names}; +use super::bound_vertex::item_box; +use super::bvh::{refit_composite, tree, union, Span, NODE}; +use super::physics::{put, put_shape, refuse}; /// The word that addresses virtual offset 0. const VIRTUAL: u64 = 0x5000_0000; diff --git a/crates/io/or-io/src/gta6/headerless/write_bound_reshape.rs b/crates/io/or-io/src/gta6/headerless/write/bound_reshape.rs similarity index 97% rename from crates/io/or-io/src/gta6/headerless/write_bound_reshape.rs rename to crates/io/or-io/src/gta6/headerless/write/bound_reshape.rs index 8f2936855..aec3b64b1 100644 --- a/crates/io/or-io/src/gta6/headerless/write_bound_reshape.rs +++ b/crates/io/or-io/src/gta6/headerless/write/bound_reshape.rs @@ -3,12 +3,12 @@ //! byte given by the angle between the two triangles and its BVH leaf fitted again; and a //! composite child's type and include entry written as two numbers. -use super::bound::GEOMETRY; -use super::bytes::sections; -use super::write_bound_vertex::item_box; -use super::write_bvh::{tree, union, Span}; -use super::write_physics::{put, refuse}; -use super::{BoundGeometry, HeaderlessError, Primitive, Result}; +use super::super::bound::GEOMETRY; +use super::super::bytes::sections; +use super::super::{BoundGeometry, HeaderlessError, Primitive, Result}; +use super::bound_vertex::item_box; +use super::bvh::{tree, union, Span}; +use super::physics::{put, refuse}; /// No neighbour across an edge. const OPEN: u16 = 0xFFFF; diff --git a/crates/io/or-io/src/gta6/headerless/write_bound_runs.rs b/crates/io/or-io/src/gta6/headerless/write/bound_runs.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_bound_runs.rs rename to crates/io/or-io/src/gta6/headerless/write/bound_runs.rs index af2d71646..7eb311dab 100644 --- a/crates/io/or-io/src/gta6/headerless/write_bound_runs.rs +++ b/crates/io/or-io/src/gta6/headerless/write/bound_runs.rs @@ -5,12 +5,12 @@ use crate::container::rpf::Rpf9Sections; -use super::bound::{child_bound, BOUND_CHILD, GEOMETRY, PLAIN_GEOMETRY}; -use super::bytes::{sections, u64_at, Bytes}; -use super::write_bound_grow::{room, BoundGrowError}; -use super::write_bvh::NODE; -use super::write_physics::{put, refuse}; -use super::{BoundGeometry, ChildBound, HeaderlessError, Result}; +use super::super::bound::{child_bound, BOUND_CHILD, GEOMETRY, PLAIN_GEOMETRY}; +use super::super::bytes::{sections, u64_at, Bytes}; +use super::super::{BoundGeometry, ChildBound, HeaderlessError, Result}; +use super::bound_grow::{room, BoundGrowError}; +use super::bvh::NODE; +use super::physics::{put, refuse}; type Grown = std::result::Result; @@ -114,7 +114,7 @@ fn runs_of(v: &[u8], at: usize, primitives: usize) -> Result> { /// `index` as maximal runs in primitive order, each an (index, length) pair of u16. // A run longer than a pair counts is split. -pub(super) fn runs_encoded(index: &[u16]) -> Vec { +pub(in crate::gta6::headerless) fn runs_encoded(index: &[u16]) -> Vec { let mut out = Vec::new(); for run in index.chunk_by(|a, b| a == b) { for part in run.chunks(LONGEST) { diff --git a/crates/io/or-io/src/gta6/headerless/write_bound_values.rs b/crates/io/or-io/src/gta6/headerless/write/bound_values.rs similarity index 96% rename from crates/io/or-io/src/gta6/headerless/write_bound_values.rs rename to crates/io/or-io/src/gta6/headerless/write/bound_values.rs index ae813b342..b2045046b 100644 --- a/crates/io/or-io/src/gta6/headerless/write_bound_values.rs +++ b/crates/io/or-io/src/gta6/headerless/write/bound_values.rs @@ -3,12 +3,14 @@ use std::cmp::Ordering; -use super::write_bound_grow::{past, MAX_VERTICES, NO_BVH, ONLY_PRIMITIVE, OPEN, OPEN_EDGE}; -use super::write_bound_runs::{geometry_value_copied, NOT_COPIED}; -use super::write_bound_vertex::item_box; -use super::write_bvh::{corners, union}; -use super::write_physics::{local_box, refuse}; -use super::{rewire_triangle, Bound, BoundChild, BoundGeometry, ChildBound, Primitive, Result}; +use super::super::{ + rewire_triangle, Bound, BoundChild, BoundGeometry, ChildBound, Primitive, Result, +}; +use super::bound_grow::{past, MAX_VERTICES, NO_BVH, ONLY_PRIMITIVE, OPEN, OPEN_EDGE}; +use super::bound_runs::{geometry_value_copied, NOT_COPIED}; +use super::bound_vertex::item_box; +use super::bvh::{corners, union}; +use super::physics::{local_box, refuse}; fn require_bvh(g: &BoundGeometry) -> Result<()> { match g.bvh { diff --git a/crates/io/or-io/src/gta6/headerless/write_bound_vertex.rs b/crates/io/or-io/src/gta6/headerless/write/bound_vertex.rs similarity index 97% rename from crates/io/or-io/src/gta6/headerless/write_bound_vertex.rs rename to crates/io/or-io/src/gta6/headerless/write/bound_vertex.rs index 55e654a90..17a5856f2 100644 --- a/crates/io/or-io/src/gta6/headerless/write_bound_vertex.rs +++ b/crates/io/or-io/src/gta6/headerless/write/bound_vertex.rs @@ -4,11 +4,13 @@ //! and the BVH's frame with it, so every vertex is quantised again and every leaf fitted; the //! composite's box, radius and BVH follow. A triangle's edge bytes are kept. -use super::bound::{cylinder_box, COMPOSITE, GEOMETRY}; -use super::bytes::sections; -use super::write_bvh::{corners, refit_composite, tree, union, Span}; -use super::write_physics::{put, put_vec3, refuse}; -use super::{read_bound, Bound, BoundGeometry, ChildBound, HeaderlessError, Primitive, Result}; +use super::super::bound::{cylinder_box, COMPOSITE, GEOMETRY}; +use super::super::bytes::sections; +use super::super::{ + read_bound, Bound, BoundGeometry, ChildBound, HeaderlessError, Primitive, Result, +}; +use super::bvh::{corners, refit_composite, tree, union, Span}; +use super::physics::{put, put_vec3, refuse}; /// GTA V's quantisation scale of a geometry over its box's half width, about 1 / 32767. const PER_HALF_WIDTH: u32 = 0x3800_0100; diff --git a/crates/io/or-io/src/gta6/headerless/write_bvh.rs b/crates/io/or-io/src/gta6/headerless/write/bvh.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_bvh.rs rename to crates/io/or-io/src/gta6/headerless/write/bvh.rs index e8b0313c3..f2aaa9155 100644 --- a/crates/io/or-io/src/gta6/headerless/write_bvh.rs +++ b/crates/io/or-io/src/gta6/headerless/write/bvh.rs @@ -2,9 +2,9 @@ //! leaf that holds a moved item boxed again in that frame, and every parent the union of its two //! children. The nodes' order, their subtree counts and the items each leaf names are kept. -use super::bytes::sections; -use super::write_physics::{local_box, put, put_vec3, refuse}; -use super::{Bound, Result}; +use super::super::bytes::sections; +use super::super::{Bound, Result}; +use super::physics::{local_box, put, put_vec3, refuse}; /// A BVH node's bytes: a quantised box, then a first item or a subtree's node count, then an item /// count, zero for a parent. diff --git a/crates/io/or-io/src/gta6/headerless/write_dictionary.rs b/crates/io/or-io/src/gta6/headerless/write/dictionary/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/write_dictionary.rs rename to crates/io/or-io/src/gta6/headerless/write/dictionary/mod.rs index abfd7fdfe..0a511911f 100644 --- a/crates/io/or-io/src/gta6/headerless/write_dictionary.rs +++ b/crates/io/or-io/src/gta6/headerless/write/dictionary/mod.rs @@ -6,11 +6,11 @@ use std::cmp::Reverse; -use super::super::tiling::{chain, Tile}; -use super::super::ttpf::{place, Format}; -use super::bytes::{sections, Bytes}; -use super::texture::is_texture; -use super::{HeaderlessError, Result}; +use super::super::super::tiling::{chain, Tile}; +use super::super::super::ttpf::{place, Format}; +use super::super::bytes::{sections, Bytes}; +use super::super::texture::is_texture; +use super::super::{HeaderlessError, Result}; use crate::codec::texture::DxgiFormat; use crate::container::rpf::{Rpf9Form, Rpf9Sections}; use crate::gta6::hash::name_hash32; @@ -718,5 +718,4 @@ pub fn write_dictionary(model: &DictionaryModel) -> Written { } #[cfg(test)] -#[path = "write_dictionary_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/headerless/write_dictionary_tests.rs b/crates/io/or-io/src/gta6/headerless/write/dictionary/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/write_dictionary_tests.rs rename to crates/io/or-io/src/gta6/headerless/write/dictionary/tests.rs diff --git a/crates/io/or-io/src/gta6/headerless/write_dictionary_entries.rs b/crates/io/or-io/src/gta6/headerless/write/dictionary_entries.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_dictionary_entries.rs rename to crates/io/or-io/src/gta6/headerless/write/dictionary_entries.rs index a3e813e6f..54c95a4ed 100644 --- a/crates/io/or-io/src/gta6/headerless/write_dictionary_entries.rs +++ b/crates/io/or-io/src/gta6/headerless/write/dictionary_entries.rs @@ -8,9 +8,9 @@ //! bytes give the same signature, so a copy carries its source's signature and a record's word at //! 0x68 with its source's bones. A removed entry's name and elements stay where they lie, unread. -use super::bytes::{sections, Bytes}; -use super::write_filter_tracks::{is_filter, is_record, ElementsError}; -use super::HeaderlessError; +use super::super::bytes::{sections, Bytes}; +use super::super::HeaderlessError; +use super::filter_tracks::{is_filter, is_record, ElementsError}; use crate::container::rpf::{grow_section, Rpf9Section, Rpf9Sections}; use crate::gta6::hash::name_hash32; diff --git a/crates/io/or-io/src/gta6/headerless/write_dictionary_textures.rs b/crates/io/or-io/src/gta6/headerless/write/dictionary_textures/mod.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_dictionary_textures.rs rename to crates/io/or-io/src/gta6/headerless/write/dictionary_textures/mod.rs index 0255fe5fb..1f7852d80 100644 --- a/crates/io/or-io/src/gta6/headerless/write_dictionary_textures.rs +++ b/crates/io/or-io/src/gta6/headerless/write/dictionary_textures/mod.rs @@ -4,11 +4,11 @@ use std::collections::{HashMap, HashSet}; -use super::write_volume::write_volume_texture; -use super::{ +use super::super::{ read_dictionary, read_dictionary_model, write_dictionary, write_texture, DictionaryWriteError, Entry, HeaderlessError, ModelTexture, }; +use super::volume::write_volume_texture; use crate::codec::texture::GrcTextureFormat; use crate::container::rpf::Rpf9Sections; use crate::gta6::Format; @@ -148,5 +148,4 @@ pub fn write_dictionary_textures(sections: &mut Rpf9Sections, held: &[HeldTextur } #[cfg(test)] -#[path = "write_dictionary_textures_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/headerless/write_dictionary_textures_tests.rs b/crates/io/or-io/src/gta6/headerless/write/dictionary_textures/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/write_dictionary_textures_tests.rs rename to crates/io/or-io/src/gta6/headerless/write/dictionary_textures/tests.rs diff --git a/crates/io/or-io/src/gta6/headerless/write_embedded.rs b/crates/io/or-io/src/gta6/headerless/write/embedded.rs similarity index 94% rename from crates/io/or-io/src/gta6/headerless/write_embedded.rs rename to crates/io/or-io/src/gta6/headerless/write/embedded.rs index e26c16a7c..89aa51633 100644 --- a/crates/io/or-io/src/gta6/headerless/write_embedded.rs +++ b/crates/io/or-io/src/gta6/headerless/write/embedded.rs @@ -2,9 +2,9 @@ //! found by the key its record at +0x30 holds, in the dictionary its shader group points at from //! +0x08, as the head's reader finds it. -use super::bytes::sections; -use super::write::write_object; -use super::{HeaderlessError, Result}; +use super::super::bytes::sections; +use super::super::{HeaderlessError, Result}; +use super::write_object; /// The texture of `key` the drawable, or its fragment's where `fragment`, embeds, from `pixels`. // `pixels` are its levels top first, as the head's reader gives them. diff --git a/crates/io/or-io/src/gta6/headerless/write_embedded_repack.rs b/crates/io/or-io/src/gta6/headerless/write/embedded_repack.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_embedded_repack.rs rename to crates/io/or-io/src/gta6/headerless/write/embedded_repack.rs index 4b72ad165..fcbc43d8e 100644 --- a/crates/io/or-io/src/gta6/headerless/write_embedded_repack.rs +++ b/crates/io/or-io/src/gta6/headerless/write/embedded_repack.rs @@ -7,12 +7,12 @@ use std::cmp::Reverse; use std::collections::HashMap; -use super::super::ttpf::Format; -use super::bytes::{sections, u64_at, Bytes}; -use super::head::{buffer_objects, BufferKind}; -use super::write_dictionary::ModelTexture; -use super::write_material::based; -use super::{HeaderlessError, Result}; +use super::super::super::ttpf::Format; +use super::super::bytes::{sections, u64_at, Bytes}; +use super::super::head::{buffer_objects, BufferKind}; +use super::super::{HeaderlessError, Result}; +use super::dictionary::ModelTexture; +use super::material::based; use crate::container::rpf::{grow_section, Rpf9Form, Rpf9GrowError, Rpf9Section, Rpf9Sections}; const VIRTUAL: u64 = 0x5000_0000; diff --git a/crates/io/or-io/src/gta6/headerless/write_filter_tracks.rs b/crates/io/or-io/src/gta6/headerless/write/filter_tracks.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_filter_tracks.rs rename to crates/io/or-io/src/gta6/headerless/write/filter_tracks.rs index e85fb41c1..c8e642fb0 100644 --- a/crates/io/or-io/src/gta6/headerless/write_filter_tracks.rs +++ b/crates/io/or-io/src/gta6/headerless/write/filter_tracks.rs @@ -7,9 +7,9 @@ //! A changed filter takes the signature at 0x0C its elements give, 0 when it holds none; a //! record's word at 0x68 follows from no rule anyone found and is kept as read. -use super::bytes::{sections, u32_at, Bytes}; -use super::dictionary::entry_of; -use super::{BoneRecord, FilterTrack, HeaderlessError}; +use super::super::bytes::{sections, u32_at, Bytes}; +use super::super::dictionary::entry_of; +use super::super::{BoneRecord, FilterTrack, HeaderlessError}; use crate::container::rpf::{grow_section, Rpf9GrowError, Rpf9Section, Rpf9Sections}; /// Where the virtual section is addressed from. @@ -182,7 +182,7 @@ fn element_name<'a>(v: Bytes<'a>, at: usize) -> Result<&'a [u8], HeaderlessError /// Each frame filter of the dictionary `virtual_section` holds: its code, the signature it states /// and the one its elements give. #[cfg(test)] -pub(super) fn filter_signatures( +pub(in crate::gta6::headerless) fn filter_signatures( virtual_section: &[u8], ) -> Result, HeaderlessError> { sections(virtual_section, None, |v, _| { diff --git a/crates/io/or-io/src/gta6/headerless/write_filters.rs b/crates/io/or-io/src/gta6/headerless/write/filters.rs similarity index 95% rename from crates/io/or-io/src/gta6/headerless/write_filters.rs rename to crates/io/or-io/src/gta6/headerless/write/filters.rs index b26b5d240..e328d4af9 100644 --- a/crates/io/or-io/src/gta6/headerless/write_filters.rs +++ b/crates/io/or-io/src/gta6/headerless/write/filters.rs @@ -2,9 +2,9 @@ //! entries the reader read; every other word of an entry is kept as it was read, but for a filter's //! signature, which a changed weight writes anew. -use super::bytes::{sections, u32_at}; -use super::dictionary::entry_of; -use super::{BoneRecord, FilterTrack, HeaderlessError, Result}; +use super::super::bytes::{sections, u32_at}; +use super::super::dictionary::entry_of; +use super::super::{BoneRecord, FilterTrack, HeaderlessError, Result}; const TRACK_LEN: usize = 48; const BONE_LEN: usize = 144; @@ -57,7 +57,7 @@ pub fn write_filter_weights( } // A weight is an input of the filter's signature. if changed { - super::write_filter_tracks::sign(virtual_section, code)?; + super::filter_tracks::sign(virtual_section, code)?; } Ok(()) } diff --git a/crates/io/or-io/src/gta6/headerless/write_fragment_child.rs b/crates/io/or-io/src/gta6/headerless/write/fragment_child.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_fragment_child.rs rename to crates/io/or-io/src/gta6/headerless/write/fragment_child.rs index f384fe14e..18dd7c7e7 100644 --- a/crates/io/or-io/src/gta6/headerless/write_fragment_child.rs +++ b/crates/io/or-io/src/gta6/headerless/write/fragment_child.rs @@ -5,18 +5,18 @@ //! record moves into the new group's range and the composite's per-child arrays, its BVH leaves //! and the vehicle glass's windows follow the children's new order. -use super::bound::bound_at; -use super::bytes::{sections, u64_at}; -use super::fragment::{apply, bind_worlds, mul, rotation, M3}; -use super::write_bound_reshape::put_child_flags; -use super::write_bvh::{corners, union, Span, NODE}; -use super::write_physics::{ - local_box, put, put_vec3, refuse, write_bound_at, write_fragment, write_fragment_bound, -}; -use super::{ +use super::super::bound::bound_at; +use super::super::bytes::{sections, u64_at}; +use super::super::fragment::{apply, bind_worlds, mul, rotation, M3}; +use super::super::{ read_drawable_with_bound, Bone, Bound, BoundChild, DrawableWithBound, Fragment, FragmentChild, GlassWindow, HeaderlessError, Result, VehicleGlass, }; +use super::bound_reshape::put_child_flags; +use super::bvh::{corners, union, Span, NODE}; +use super::physics::{ + local_box, put, put_vec3, refuse, write_bound_at, write_fragment, write_fragment_bound, +}; /// A fragment child record's bytes. const CHILD: usize = 0x50; @@ -547,7 +547,7 @@ fn regroup_written( if r.iter().zip(e).all(same) { return Ok(false); } - let kept = |(a, b): (&super::FragmentGroup, &super::FragmentGroup)| { + let kept = |(a, b): (&super::super::FragmentGroup, &super::super::FragmentGroup)| { (a.bone, a.bone_hash, a.parent, &a.child_groups) == (b.bone, b.bone_hash, b.parent, &b.child_groups) }; diff --git a/crates/io/or-io/src/gta6/headerless/write_geometry/cut.rs b/crates/io/or-io/src/gta6/headerless/write/geometry/cut/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/write_geometry/cut.rs rename to crates/io/or-io/src/gta6/headerless/write/geometry/cut/mod.rs index 477f8598b..d8c722796 100644 --- a/crates/io/or-io/src/gta6/headerless/write_geometry/cut.rs +++ b/crates/io/or-io/src/gta6/headerless/write/geometry/cut/mod.rs @@ -10,7 +10,7 @@ use std::collections::HashMap; -use super::super::write_material::based; +use super::super::material::based; use super::per_geometry::layout_holds; use super::{ extremes, floats, locate, place, put, put_box, read_box, rebox, sections, u64_at, union, @@ -336,7 +336,7 @@ const LIST_LIMIT: usize = 0xFFFF; /// A meshlet holds no more than this many vertices or triangles, as [`meshlets`] packs them. const MESHLET_LIMIT: usize = 128; -/// A running image of how [`super::super::geometry_encode::meshlets`] would pack a piece's +/// A running image of how [`super::super::super::geometry_encode::meshlets`] would pack a piece's /// triangles, kept to bound the piece by the vertex-list total those meshlets reach. #[derive(Default)] struct MeshletFit { @@ -645,5 +645,4 @@ fn table(v: &[u8], root: usize, models: &[Vec]) -> Written { } #[cfg(test)] -#[path = "cut_palette_tests.rs"] mod palette_tests; diff --git a/crates/io/or-io/src/gta6/headerless/write_geometry/cut_palette_tests.rs b/crates/io/or-io/src/gta6/headerless/write/geometry/cut/palette_tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/write_geometry/cut_palette_tests.rs rename to crates/io/or-io/src/gta6/headerless/write/geometry/cut/palette_tests.rs diff --git a/crates/io/or-io/src/gta6/headerless/write_geometry/mod.rs b/crates/io/or-io/src/gta6/headerless/write/geometry/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/write_geometry/mod.rs rename to crates/io/or-io/src/gta6/headerless/write/geometry/mod.rs index e01bb85fb..f699dd619 100644 --- a/crates/io/or-io/src/gta6/headerless/write_geometry/mod.rs +++ b/crates/io/or-io/src/gta6/headerless/write/geometry/mod.rs @@ -6,16 +6,16 @@ //! ⚠ The geometry's word at +0x30 is a digest of its content that nothing can derive; it is left //! as read. -use super::bytes::{f32_at, sections, u32_at, u64_at}; -use super::dictionary::entry_of; -use super::drawable::{drawable_at, Channel, Geometry}; -use super::geometry_encode::{ +use super::super::bytes::{f32_at, sections, u32_at, u64_at}; +use super::super::dictionary::entry_of; +use super::super::drawable::{drawable_at, Channel, Geometry}; +use super::super::geometry_encode::{ frame_word, index_words, meshlet_bounds, meshlets, pack_lanes, s16_pair, unorm10_word, unorm_bytes, Quantisation, }; -use super::streams::{lanes, SLOT_CHANNELS}; -use super::write_physics::put; -use super::HeaderlessError; +use super::super::streams::{lanes, SLOT_CHANNELS}; +use super::super::HeaderlessError; +use super::physics::put; use crate::container::rpf::{grow_section, Rpf9GrowError, Rpf9Role, Rpf9Section, Rpf9Sections}; mod cut; diff --git a/crates/io/or-io/src/gta6/headerless/write_geometry/per_geometry_build_tests.rs b/crates/io/or-io/src/gta6/headerless/write/geometry/per_geometry/build_tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/write_geometry/per_geometry_build_tests.rs rename to crates/io/or-io/src/gta6/headerless/write/geometry/per_geometry/build_tests.rs diff --git a/crates/io/or-io/src/gta6/headerless/write_geometry/per_geometry.rs b/crates/io/or-io/src/gta6/headerless/write/geometry/per_geometry/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/write_geometry/per_geometry.rs rename to crates/io/or-io/src/gta6/headerless/write/geometry/per_geometry/mod.rs index aa38f81f5..f37fb9c70 100644 --- a/crates/io/or-io/src/gta6/headerless/write_geometry/per_geometry.rs +++ b/crates/io/or-io/src/gta6/headerless/write/geometry/per_geometry/mod.rs @@ -479,7 +479,6 @@ fn one_element(v: &mut [u8], t: &Table, corners: Corners) -> Written { } #[cfg(test)] -#[path = "per_geometry_build_tests.rs"] mod build_tests; #[cfg(test)] diff --git a/crates/io/or-io/src/gta6/headerless/write_geometry/posed.rs b/crates/io/or-io/src/gta6/headerless/write/geometry/posed.rs similarity index 96% rename from crates/io/or-io/src/gta6/headerless/write_geometry/posed.rs rename to crates/io/or-io/src/gta6/headerless/write/geometry/posed.rs index dfbfa7459..c9730f2e0 100644 --- a/crates/io/or-io/src/gta6/headerless/write_geometry/posed.rs +++ b/crates/io/or-io/src/gta6/headerless/write/geometry/posed.rs @@ -2,10 +2,10 @@ //! bind: each vertex through its bones' bind world times inverse bind, weighted, as the skinning of //! a posed drawable takes them. -use super::super::dictionary::entry_of; -use super::super::drawable::{drawable_at, Geometry, Model, Palette}; -use super::super::fragment::{apply, bind_worlds, mul, M3}; -use super::super::skeleton::Skeleton; +use super::super::super::dictionary::entry_of; +use super::super::super::drawable::{drawable_at, Geometry, Model, Palette}; +use super::super::super::fragment::{apply, bind_worlds, mul, M3}; +use super::super::super::skeleton::Skeleton; use super::{extremes, floats, put, put_box, sections, GeometryWriteError, Written}; use crate::container::rpf::{Rpf9Role, Rpf9Sections}; use crate::gta6::headerless::HeaderlessError; diff --git a/crates/io/or-io/src/gta6/headerless/write_geometry/reference.rs b/crates/io/or-io/src/gta6/headerless/write/geometry/reference.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/write_geometry/reference.rs rename to crates/io/or-io/src/gta6/headerless/write/geometry/reference.rs diff --git a/crates/io/or-io/src/gta6/headerless/write_geometry/reference_cells.rs b/crates/io/or-io/src/gta6/headerless/write/geometry/reference_cells.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/write_geometry/reference_cells.rs rename to crates/io/or-io/src/gta6/headerless/write/geometry/reference_cells.rs diff --git a/crates/io/or-io/src/gta6/headerless/write_geometry/skin.rs b/crates/io/or-io/src/gta6/headerless/write/geometry/skin.rs similarity index 100% rename from crates/io/or-io/src/gta6/headerless/write_geometry/skin.rs rename to crates/io/or-io/src/gta6/headerless/write/geometry/skin.rs diff --git a/crates/io/or-io/src/gta6/headerless/write_geometry_replace.rs b/crates/io/or-io/src/gta6/headerless/write/geometry_replace.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_geometry_replace.rs rename to crates/io/or-io/src/gta6/headerless/write/geometry_replace.rs index 10e5e549e..5e190d7e8 100644 --- a/crates/io/or-io/src/gta6/headerless/write_geometry_replace.rs +++ b/crates/io/or-io/src/gta6/headerless/write/geometry_replace.rs @@ -3,12 +3,12 @@ //! root's word at +0xB8), the geometry's place found through rows 1, 2 and 3, and the `u32` at //! +0x0C of the geometry's first row 4 element, where 0xFF takes the geometry out of streaming. -use super::bytes::{sections as bounded, Bytes}; -use super::dictionary::entry_of; -use super::write_geometry::{ +use super::super::bytes::{sections as bounded, Bytes}; +use super::super::dictionary::entry_of; +use super::super::HeaderlessError; +use super::geometry::{ write_geometry, GeometryAt, GeometryEdit, GeometryWriteError, GeometryWritten, }; -use super::HeaderlessError; use crate::container::rpf::{Rpf9Role, Rpf9Sections}; /// A geometry's vertex list holds u16 entries, so it names at most this many vertices. diff --git a/crates/io/or-io/src/gta6/headerless/write_material.rs b/crates/io/or-io/src/gta6/headerless/write/material.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_material.rs rename to crates/io/or-io/src/gta6/headerless/write/material.rs index 8c861fbe8..517f0f622 100644 --- a/crates/io/or-io/src/gta6/headerless/write_material.rs +++ b/crates/io/or-io/src/gta6/headerless/write/material.rs @@ -6,11 +6,11 @@ //! ⚠ Every based word of the virtual section is taken for a pointer: in drawables, fragments and //! dictionaries no word of that shape that a reader types is data. -use super::bytes::{sections, u64_at, Bytes}; -use super::dictionary::entry_of; -use super::drawable::{drawable_at, is_drawable_root, shaders_at, Drawable}; -use super::write::write_shaders; -use super::{HeaderlessError, ParameterValue, Result, Shader}; +use super::super::bytes::{sections, u64_at, Bytes}; +use super::super::dictionary::entry_of; +use super::super::drawable::{drawable_at, is_drawable_root, shaders_at, Drawable}; +use super::super::{HeaderlessError, ParameterValue, Result, Shader}; +use super::write_shaders; use crate::container::rpf::{grow_section, Rpf9GrowError, Rpf9Role, Rpf9Section, Rpf9Sections}; /// The base of a virtual-section pointer. diff --git a/crates/io/or-io/src/gta6/headerless/write.rs b/crates/io/or-io/src/gta6/headerless/write/mod.rs similarity index 77% rename from crates/io/or-io/src/gta6/headerless/write.rs rename to crates/io/or-io/src/gta6/headerless/write/mod.rs index ff3b873a0..8cfba4e52 100644 --- a/crates/io/or-io/src/gta6/headerless/write.rs +++ b/crates/io/or-io/src/gta6/headerless/write/mod.rs @@ -1,6 +1,80 @@ //! Edits written back into a resource's sections where they move nothing: a drawable's constants //! and texture keys where the reader read them, and a dictionary texture's levels into its tiles. +mod bone_names; +mod bound_grow; +mod bound_reshape; +pub(super) mod bound_runs; +mod bound_values; +mod bound_vertex; +mod bvh; +mod dictionary; +mod dictionary_entries; +mod dictionary_textures; +mod embedded; +mod embedded_repack; +pub(super) mod filter_tracks; +mod filters; +mod fragment_child; +mod geometry; +mod geometry_replace; +mod material; +mod navmesh; +mod navmesh_delete; +mod navmesh_links; +mod navmesh_side; +mod palette; +mod physics; +mod skeleton; +mod volume; + +pub use bone_names::{bone_name_holds, rename_bones, BoneNameError}; +pub use bound_grow::{ + add_bound_primitive, add_bound_vertex, copy_bound_child, delete_bound_child, + delete_bound_primitive, delete_bound_vertex, fit_composite_box, reshape_bound_body, + retyped_bound_child, write_retyped, BoundGrowError, BoundHolder, BoundReshape, +}; +pub use bound_reshape::{edge_byte, rewire_triangle}; +pub use bound_vertex::{vertex_move_holds, write_bound_vertices}; +pub use dictionary::{ + read_dictionary_model, write_dictionary, DictionaryModel, DictionaryWriteError, ModelTexture, +}; +pub use dictionary_entries::{copy_dictionary_entry, entry_key, remove_dictionary_entry}; +pub use dictionary_textures::{write_dictionary_textures, HeldTexture, TexturePlanError}; +pub use embedded::write_embedded_texture; +pub use embedded_repack::{ + embed_texture, key_word, reshape_embedded_texture, unembed_texture, EmbedError, +}; +pub use filter_tracks::{write_filter_tracks, write_record_bones, ElementsError}; +pub use filters::{write_filter_weights, write_record_values}; +pub use fragment_child::{ + fragment_child_local_in, fragment_child_place, place_fragment_child, regroup_fragment_child, + write_fragment_level, +}; +pub use geometry::{bind_positions, rebox_bind_pose}; +pub use geometry::{write_geometry, GeometryAt, GeometryEdit, GeometryWriteError, GeometryWritten}; +pub use geometry::{write_geometry_cut, GeometryCut}; +pub use geometry_replace::{ + replace_geometry, streamed_geometry, GeometryReplaceError, GeometryReplaced, Streamed, +}; +pub use material::stated_words; +pub use material::{ + shader_layout_holds, write_materials, write_materials_with, MaterialLayoutError, +}; +pub use navmesh::{cut_edges, links_into, polygon_cut, PolygonCut}; +pub use navmesh_delete::{ + delete_polygon, deletion, disable_polygon, disabling, polygon_deleted, NavDeleteError, + NavRebuild, +}; +pub use navmesh_links::{relinked, with_links, write_links}; +pub use palette::{write_palette, PaletteAdd}; +pub use physics::{ + bound_placement_holds, write_bound, write_drawable_bound, write_fragment, write_fragment_bound, + write_polygon_flags, +}; +pub use skeleton::{rebind_under, write_skeleton}; +pub use volume::write_volume_texture; + use std::collections::BTreeMap; use super::super::tiling::{chain, Tile}; @@ -163,7 +237,7 @@ pub fn write_texture( /// The texture object at `at` written from `pixels`, as [`write_texture`] writes a dictionary's; /// its name read where `named`, as an embedded dictionary's record holds a key there instead. -pub(super) fn write_object( +fn write_object( virtual_section: &[u8], physical: &mut [u8], at: usize, diff --git a/crates/io/or-io/src/gta6/headerless/write_navmesh.rs b/crates/io/or-io/src/gta6/headerless/write/navmesh.rs similarity index 96% rename from crates/io/or-io/src/gta6/headerless/write_navmesh.rs rename to crates/io/or-io/src/gta6/headerless/write/navmesh.rs index dccc16741..dc1aab933 100644 --- a/crates/io/or-io/src/gta6/headerless/write_navmesh.rs +++ b/crates/io/or-io/src/gta6/headerless/write/navmesh.rs @@ -2,9 +2,9 @@ //! of it and into it written as leading nowhere. Nothing moves and no count changes; its flags, the //! leaves and the special links that name it are kept. -use super::bytes::sections; -use super::write_physics::{items, put, refuse}; -use super::{read_navmesh, HeaderlessError, NavMesh, Result, SpecialLink, NOWHERE}; +use super::super::bytes::sections; +use super::super::{read_navmesh, HeaderlessError, NavMesh, Result, SpecialLink, NOWHERE}; +use super::physics::{items, put, refuse}; /// An adjacency record's bytes. const EDGE: usize = 12; diff --git a/crates/io/or-io/src/gta6/headerless/write_navmesh_delete.rs b/crates/io/or-io/src/gta6/headerless/write/navmesh_delete.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/write_navmesh_delete.rs rename to crates/io/or-io/src/gta6/headerless/write/navmesh_delete.rs index 592204286..9d9bdd736 100644 --- a/crates/io/or-io/src/gta6/headerless/write_navmesh_delete.rs +++ b/crates/io/or-io/src/gta6/headerless/write/navmesh_delete.rs @@ -13,12 +13,12 @@ use std::collections::HashSet; use crate::container::rpf::{grow_section, Rpf9GrowError, Rpf9Section, Rpf9Sections}; -use super::bytes::{sections, Bytes}; -use super::write_navmesh_side::{rechained, Corner}; -use super::write_physics::put; -use super::{ +use super::super::bytes::{sections, Bytes}; +use super::super::{ read_navmesh, HeaderlessError, NavEdge, NavMesh, NavNode, NavPolygon, Result, SpecialLink, }; +use super::navmesh_side::{rechained, Corner}; +use super::physics::put; /// The bytes of one split array chunk, as the reader takes them. const CHUNK: usize = 16384; @@ -520,7 +520,7 @@ fn rebuilt(m: &NavMesh, p: usize, gone: bool, others: &[&NavMesh]) -> Done Option { diff --git a/crates/io/or-io/src/gta6/headerless/write_navmesh_side.rs b/crates/io/or-io/src/gta6/headerless/write/navmesh_side.rs similarity index 99% rename from crates/io/or-io/src/gta6/headerless/write_navmesh_side.rs rename to crates/io/or-io/src/gta6/headerless/write/navmesh_side.rs index db1e7aea2..8adfb2510 100644 --- a/crates/io/or-io/src/gta6/headerless/write_navmesh_side.rs +++ b/crates/io/or-io/src/gta6/headerless/write/navmesh_side.rs @@ -4,7 +4,7 @@ //! ⚠ Corner 0's piece leads nowhere in every shipped record and corner 1's never does; no two //! pieces after corner 0's lead nowhere in a row. Corner 0 is never dropped. -use super::{NavEdge, NOWHERE}; +use super::super::{NavEdge, NOWHERE}; /// A record's corner: its vertex, the edge from it to the next corner, the record that edge leads /// to, and the stored edge it was. diff --git a/crates/io/or-io/src/gta6/headerless/write_palette.rs b/crates/io/or-io/src/gta6/headerless/write/palette.rs similarity index 97% rename from crates/io/or-io/src/gta6/headerless/write_palette.rs rename to crates/io/or-io/src/gta6/headerless/write/palette.rs index cca0b267c..38834d447 100644 --- a/crates/io/or-io/src/gta6/headerless/write_palette.rs +++ b/crates/io/or-io/src/gta6/headerless/write/palette.rs @@ -3,13 +3,13 @@ //! every blend index of the model's geometries follows its bone; a bone mask takes each bone's bit //! in place. -use super::bytes::{sections, u32_at, u64_at}; -use super::dictionary::entry_of; -use super::drawable::{drawable_at, Model, Palette}; -use super::write_geometry::{write_geometry, GeometryAt, GeometryEdit, GeometryWriteError}; -use super::write_material::based; -use super::write_physics::put; -use super::HeaderlessError; +use super::super::bytes::{sections, u32_at, u64_at}; +use super::super::dictionary::entry_of; +use super::super::drawable::{drawable_at, Model, Palette}; +use super::super::HeaderlessError; +use super::geometry::{write_geometry, GeometryAt, GeometryEdit, GeometryWriteError}; +use super::material::based; +use super::physics::put; use crate::container::rpf::{grow_section, Rpf9Role, Rpf9Section, Rpf9Sections}; const VIRTUAL_TAG: u64 = 0x5000_0000; diff --git a/crates/io/or-io/src/gta6/headerless/write_physics.rs b/crates/io/or-io/src/gta6/headerless/write/physics.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_physics.rs rename to crates/io/or-io/src/gta6/headerless/write/physics.rs index 6464f06f8..03a8f84fb 100644 --- a/crates/io/or-io/src/gta6/headerless/write_physics.rs +++ b/crates/io/or-io/src/gta6/headerless/write/physics.rs @@ -2,15 +2,15 @@ //! resource's sections where they move nothing: the body is read before and after, and an edit //! the reader would not read back is refused. -use super::bound::COMPOSITE; -use super::bytes::{sections, u64_at, Bytes}; -use super::write_bound_reshape::{put_child_flags, write_rewired}; -use super::write_bound_vertex::write_bound_vertices_at; -use super::write_bvh::refit_composite; -use super::{ +use super::super::bound::COMPOSITE; +use super::super::bytes::{sections, u64_at, Bytes}; +use super::super::{ read_bound, read_drawable, read_drawable_with_bound, read_navmesh, Bound, BoundChild, BoundGeometry, ChildBound, Fragment, HeaderlessError, Result, }; +use super::bound_reshape::{put_child_flags, write_rewired}; +use super::bound_vertex::write_bound_vertices_at; +use super::bvh::refit_composite; /// A polygon record's bytes. const POLYGON: usize = 44; diff --git a/crates/io/or-io/src/gta6/headerless/write_skeleton.rs b/crates/io/or-io/src/gta6/headerless/write/skeleton.rs similarity index 98% rename from crates/io/or-io/src/gta6/headerless/write_skeleton.rs rename to crates/io/or-io/src/gta6/headerless/write/skeleton.rs index d07187aa7..00bbeffb7 100644 --- a/crates/io/or-io/src/gta6/headerless/write_skeleton.rs +++ b/crates/io/or-io/src/gta6/headerless/write/skeleton.rs @@ -2,9 +2,9 @@ //! its local matrix at the pointer at 0x38, and the inverse bind world of it and of every bone //! under it, each world its parent's world times its local. -use super::bytes::sections; -use super::skeleton::{owner_at, read_skeleton_of, SkeletonOwner}; -use super::{Bone, HeaderlessError, Result, Skeleton}; +use super::super::bytes::sections; +use super::super::skeleton::{owner_at, read_skeleton_of, SkeletonOwner}; +use super::super::{Bone, HeaderlessError, Result, Skeleton}; /// Four columns, x, y and z, the last the translation: the lanes a skeleton's matrices use. type Affine = [[f32; 3]; 4]; diff --git a/crates/io/or-io/src/gta6/headerless/write_volume.rs b/crates/io/or-io/src/gta6/headerless/write/volume.rs similarity index 93% rename from crates/io/or-io/src/gta6/headerless/write_volume.rs rename to crates/io/or-io/src/gta6/headerless/write/volume.rs index da0f8e666..de7ec475a 100644 --- a/crates/io/or-io/src/gta6/headerless/write_volume.rs +++ b/crates/io/or-io/src/gta6/headerless/write/volume.rs @@ -1,11 +1,11 @@ //! A dictionary's volume texture written from its slices into the z-slabs of tiles it reads from, //! each level's planes into every slab, every slab holding part of each level; nothing moves. -use super::super::tiling::{place_planes, volume_chain, Tile}; -use super::bytes::sections; -use super::dictionary::entry_of; -use super::texture::{is_texture, texture_at}; -use super::{HeaderlessError, Result}; +use super::super::super::tiling::{place_planes, volume_chain, Tile}; +use super::super::bytes::sections; +use super::super::dictionary::entry_of; +use super::super::texture::{is_texture, texture_at}; +use super::super::{HeaderlessError, Result}; use crate::codec::texture::DxgiFormat; use crate::gta6::hash::name_hash32; diff --git a/crates/io/or-io/src/gta6/map_author.rs b/crates/io/or-io/src/gta6/map/author.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_author.rs rename to crates/io/or-io/src/gta6/map/author.rs diff --git a/crates/io/or-io/src/gta6/map_grow.rs b/crates/io/or-io/src/gta6/map/grow/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/map_grow.rs rename to crates/io/or-io/src/gta6/map/grow/mod.rs index 968f71c0d..ba459c52e 100644 --- a/crates/io/or-io/src/gta6/map_grow.rs +++ b/crates/io/or-io/src/gta6/map/grow/mod.rs @@ -95,7 +95,6 @@ pub enum MapGrowError { type Result = std::result::Result; -#[path = "map_grow_orphans.rs"] mod orphans; /// Adds a copy of entity `from` as the map's last entity; returns its index. diff --git a/crates/io/or-io/src/gta6/map_grow_orphans.rs b/crates/io/or-io/src/gta6/map/grow/orphans.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_grow_orphans.rs rename to crates/io/or-io/src/gta6/map/grow/orphans.rs diff --git a/crates/io/or-io/src/gta6/map_index_types.rs b/crates/io/or-io/src/gta6/map/index_types/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/map_index_types.rs rename to crates/io/or-io/src/gta6/map/index_types/mod.rs index 488fbb0d3..d1e5a3622 100644 --- a/crates/io/or-io/src/gta6/map_index_types.rs +++ b/crates/io/or-io/src/gta6/map/index_types/mod.rs @@ -132,5 +132,4 @@ fn load_flags_in( } #[cfg(test)] -#[path = "map_index_types_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/map_index_types_tests.rs b/crates/io/or-io/src/gta6/map/index_types/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_index_types_tests.rs rename to crates/io/or-io/src/gta6/map/index_types/tests.rs diff --git a/crates/io/or-io/src/gta6/map_interior.rs b/crates/io/or-io/src/gta6/map/interior/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/map_interior.rs rename to crates/io/or-io/src/gta6/map/interior/mod.rs index 07444c22e..68ae11c2e 100644 --- a/crates/io/or-io/src/gta6/map_interior.rs +++ b/crates/io/or-io/src/gta6/map/interior/mod.rs @@ -353,5 +353,4 @@ pub fn read_instances(model: &RbmModel) -> Result> { } #[cfg(test)] -#[path = "map_interior_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/map_interior_tests.rs b/crates/io/or-io/src/gta6/map/interior/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_interior_tests.rs rename to crates/io/or-io/src/gta6/map/interior/tests.rs diff --git a/crates/io/or-io/src/gta6/map_lanes.rs b/crates/io/or-io/src/gta6/map/lanes/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/map_lanes.rs rename to crates/io/or-io/src/gta6/map/lanes/mod.rs index 188c8528e..1540a0530 100644 --- a/crates/io/or-io/src/gta6/map_lanes.rs +++ b/crates/io/or-io/src/gta6/map/lanes/mod.rs @@ -567,5 +567,4 @@ impl LaneGraph { } #[cfg(test)] -#[path = "map_lanes_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/map_lanes_tests.rs b/crates/io/or-io/src/gta6/map/lanes/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_lanes_tests.rs rename to crates/io/or-io/src/gta6/map/lanes/tests.rs diff --git a/crates/io/or-io/src/gta6/map_light_ext.rs b/crates/io/or-io/src/gta6/map/light_ext/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/map_light_ext.rs rename to crates/io/or-io/src/gta6/map/light_ext/mod.rs index 51a450889..820d9cb59 100644 --- a/crates/io/or-io/src/gta6/map_light_ext.rs +++ b/crates/io/or-io/src/gta6/map/light_ext/mod.rs @@ -138,5 +138,4 @@ pub fn archetype_lights(model: &RbmModel) -> Result)>> { } #[cfg(test)] -#[path = "map_light_ext_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/map_light_ext_tests.rs b/crates/io/or-io/src/gta6/map/light_ext/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_light_ext_tests.rs rename to crates/io/or-io/src/gta6/map/light_ext/tests.rs diff --git a/crates/io/or-io/src/gta6/map_lights.rs b/crates/io/or-io/src/gta6/map/lights/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/map_lights.rs rename to crates/io/or-io/src/gta6/map/lights/mod.rs index f3e778e27..eb10a99e0 100644 --- a/crates/io/or-io/src/gta6/map_lights.rs +++ b/crates/io/or-io/src/gta6/map/lights/mod.rs @@ -590,5 +590,4 @@ pub fn place(effect: &LightEffect, light: &LightAttr, entity: &Entity) -> Placed } #[cfg(test)] -#[path = "map_lights_tests.rs"] pub(super) mod tests; diff --git a/crates/io/or-io/src/gta6/map_lights_tests.rs b/crates/io/or-io/src/gta6/map/lights/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_lights_tests.rs rename to crates/io/or-io/src/gta6/map/lights/tests.rs diff --git a/crates/io/or-io/src/gta6/map_lights_index.rs b/crates/io/or-io/src/gta6/map/lights_index.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_lights_index.rs rename to crates/io/or-io/src/gta6/map/lights_index.rs diff --git a/crates/io/or-io/src/gta6/map_lights_lod.rs b/crates/io/or-io/src/gta6/map/lights_lod.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_lights_lod.rs rename to crates/io/or-io/src/gta6/map/lights_lod.rs diff --git a/crates/io/or-io/src/gta6/map_links.rs b/crates/io/or-io/src/gta6/map/links/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/map_links.rs rename to crates/io/or-io/src/gta6/map/links/mod.rs index 17955b43e..43c7a62db 100644 --- a/crates/io/or-io/src/gta6/map_links.rs +++ b/crates/io/or-io/src/gta6/map/links/mod.rs @@ -792,5 +792,4 @@ fn interior(blocks: &Blocks, archetype: usize, a: &[u8], what: &str) -> Result Result { } } -#[path = "map_links.rs"] pub mod links; -#[path = "map_grow.rs"] pub mod grow; -#[path = "map_lights.rs"] pub mod lights; -#[path = "map_light_ext.rs"] pub mod light_ext; -#[path = "map_lanes.rs"] pub mod lanes; -#[path = "map_world.rs"] pub mod world; -#[path = "map_author.rs"] pub mod author; -#[path = "map_stream.rs"] pub mod stream; -#[path = "map_interior.rs"] pub mod interior; -#[path = "map_occluders.rs"] pub mod occluders; -#[path = "map_index_types.rs"] pub mod index_types; -#[path = "map_lights_lod.rs"] pub mod lights_lod; -#[path = "map_lights_index.rs"] pub mod lights_index; #[cfg(test)] -#[path = "map_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/map_occluders.rs b/crates/io/or-io/src/gta6/map/occluders/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/map_occluders.rs rename to crates/io/or-io/src/gta6/map/occluders/mod.rs index 96c7d5877..930e1270b 100644 --- a/crates/io/or-io/src/gta6/map_occluders.rs +++ b/crates/io/or-io/src/gta6/map/occluders/mod.rs @@ -252,5 +252,4 @@ fn occlude_model(blocks: &Blocks, m: &[u8], what: &str) -> Result } #[cfg(test)] -#[path = "map_occluders_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/map_occluders_tests.rs b/crates/io/or-io/src/gta6/map/occluders/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_occluders_tests.rs rename to crates/io/or-io/src/gta6/map/occluders/tests.rs diff --git a/crates/io/or-io/src/gta6/map_grass.rs b/crates/io/or-io/src/gta6/map/stream/grass/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/map_grass.rs rename to crates/io/or-io/src/gta6/map/stream/grass/mod.rs index a36211f3c..98aff2495 100644 --- a/crates/io/or-io/src/gta6/map_grass.rs +++ b/crates/io/or-io/src/gta6/map/stream/grass/mod.rs @@ -245,9 +245,7 @@ pub(super) fn lists( .collect() } -#[path = "map_slod.rs"] pub mod slod; #[cfg(test)] -#[path = "map_grass_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/map_slod.rs b/crates/io/or-io/src/gta6/map/stream/grass/slod/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/map_slod.rs rename to crates/io/or-io/src/gta6/map/stream/grass/slod/mod.rs index 18a631a3f..aed84cff8 100644 --- a/crates/io/or-io/src/gta6/map_slod.rs +++ b/crates/io/or-io/src/gta6/map/stream/grass/slod/mod.rs @@ -125,5 +125,4 @@ fn settle( } #[cfg(test)] -#[path = "map_slod_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/map_slod_tests.rs b/crates/io/or-io/src/gta6/map/stream/grass/slod/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_slod_tests.rs rename to crates/io/or-io/src/gta6/map/stream/grass/slod/tests.rs diff --git a/crates/io/or-io/src/gta6/map_grass_tests.rs b/crates/io/or-io/src/gta6/map/stream/grass/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_grass_tests.rs rename to crates/io/or-io/src/gta6/map/stream/grass/tests.rs diff --git a/crates/io/or-io/src/gta6/map_stream.rs b/crates/io/or-io/src/gta6/map/stream/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/map_stream.rs rename to crates/io/or-io/src/gta6/map/stream/mod.rs index ecf9b6e6e..a8c787e8d 100644 --- a/crates/io/or-io/src/gta6/map_stream.rs +++ b/crates/io/or-io/src/gta6/map/stream/mod.rs @@ -286,9 +286,7 @@ fn prop_lists(model: &RbmModel, map: &MapData, links: &MapLinks) -> Result Result, MapGridError> { } #[cfg(test)] -#[path = "map_grid_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/map_grid_tests.rs b/crates/io/or-io/src/gta6/map_grid/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/map_grid_tests.rs rename to crates/io/or-io/src/gta6/map_grid/tests.rs diff --git a/crates/io/or-io/src/gta6/mission_other.rs b/crates/io/or-io/src/gta6/mission_other/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/mission_other.rs rename to crates/io/or-io/src/gta6/mission_other/mod.rs index 2da485d6b..a4d7ef8d9 100644 --- a/crates/io/or-io/src/gta6/mission_other.rs +++ b/crates/io/or-io/src/gta6/mission_other/mod.rs @@ -118,5 +118,4 @@ impl Declared { } #[cfg(test)] -#[path = "mission_other_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/mission_other_tests.rs b/crates/io/or-io/src/gta6/mission_other/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/mission_other_tests.rs rename to crates/io/or-io/src/gta6/mission_other/tests.rs diff --git a/crates/io/or-io/src/gta6/mission_tables.rs b/crates/io/or-io/src/gta6/mission_tables/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/mission_tables.rs rename to crates/io/or-io/src/gta6/mission_tables/mod.rs index 10d7dfd3c..799d05662 100644 --- a/crates/io/or-io/src/gta6/mission_tables.rs +++ b/crates/io/or-io/src/gta6/mission_tables/mod.rs @@ -303,5 +303,4 @@ pub fn read_element( } #[cfg(test)] -#[path = "mission_tables_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/mission_tables_tests.rs b/crates/io/or-io/src/gta6/mission_tables/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/mission_tables_tests.rs rename to crates/io/or-io/src/gta6/mission_tables/tests.rs diff --git a/crates/io/or-io/src/gta6/mod.rs b/crates/io/or-io/src/gta6/mod.rs index a29d3b016..6ca923606 100644 --- a/crates/io/or-io/src/gta6/mod.rs +++ b/crates/io/or-io/src/gta6/mod.rs @@ -9,9 +9,10 @@ pub mod accel; pub mod anim; #[cfg(feature = "meta")] pub mod anim_scene; -pub mod audio_data; -pub mod audio_links; -pub mod audio_radio; +pub mod audio; +pub use audio::data as audio_data; +pub use audio::links as audio_links; +pub use audio::radio as audio_radio; pub mod bcpack; #[cfg(feature = "meta")] pub mod constellations; @@ -36,10 +37,10 @@ pub mod ped_assets; pub mod ped_catalogue; pub mod platform; pub mod save; -pub mod save_codec; -pub mod save_crypto; -pub mod save_stats; -pub mod save_story; +pub use save::codec as save_codec; +pub use save::crypto as save_crypto; +pub use save::stats as save_stats; +pub use save::story as save_story; #[cfg(feature = "meta")] pub mod skin_tones; // Its natives list is GTA V's `NativeDb`, which `gta5` builds. diff --git a/crates/io/or-io/src/gta6/move_network.rs b/crates/io/or-io/src/gta6/move_network/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/move_network.rs rename to crates/io/or-io/src/gta6/move_network/mod.rs index 95b2fd36b..1fac73b6e 100644 --- a/crates/io/or-io/src/gta6/move_network.rs +++ b/crates/io/or-io/src/gta6/move_network/mod.rs @@ -843,5 +843,4 @@ fn refuse(why: String) -> Error { } #[cfg(test)] -#[path = "move_network_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/move_network_tests.rs b/crates/io/or-io/src/gta6/move_network/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/move_network_tests.rs rename to crates/io/or-io/src/gta6/move_network/tests.rs diff --git a/crates/io/or-io/src/gta6/names.rs b/crates/io/or-io/src/gta6/names/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/names.rs rename to crates/io/or-io/src/gta6/names/mod.rs index 4a398fada..397c04b3e 100644 --- a/crates/io/or-io/src/gta6/names.rs +++ b/crates/io/or-io/src/gta6/names/mod.rs @@ -1003,5 +1003,4 @@ impl super::map::links::InteriorEntity { } #[cfg(test)] -#[path = "names_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/names_tests.rs b/crates/io/or-io/src/gta6/names/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/names_tests.rs rename to crates/io/or-io/src/gta6/names/tests.rs diff --git a/crates/io/or-io/src/gta6/other_bodies_edup_tests.rs b/crates/io/or-io/src/gta6/other_bodies/edup_tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/other_bodies_edup_tests.rs rename to crates/io/or-io/src/gta6/other_bodies/edup_tests.rs diff --git a/crates/io/or-io/src/gta6/other_bodies.rs b/crates/io/or-io/src/gta6/other_bodies/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/other_bodies.rs rename to crates/io/or-io/src/gta6/other_bodies/mod.rs index 6741b0b4a..fc276510f 100644 --- a/crates/io/or-io/src/gta6/other_bodies.rs +++ b/crates/io/or-io/src/gta6/other_bodies/mod.rs @@ -810,9 +810,7 @@ fn refuse(what: &str, why: String) -> Error { } #[cfg(test)] -#[path = "other_bodies_tests.rs"] mod tests; #[cfg(test)] -#[path = "other_bodies_edup_tests.rs"] mod edup_tests; diff --git a/crates/io/or-io/src/gta6/other_bodies_tests.rs b/crates/io/or-io/src/gta6/other_bodies/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/other_bodies_tests.rs rename to crates/io/or-io/src/gta6/other_bodies/tests.rs diff --git a/crates/io/or-io/src/gta6/ped_assets.rs b/crates/io/or-io/src/gta6/ped_assets/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/ped_assets.rs rename to crates/io/or-io/src/gta6/ped_assets/mod.rs index 9c433fd61..eed9e4573 100644 --- a/crates/io/or-io/src/gta6/ped_assets.rs +++ b/crates/io/or-io/src/gta6/ped_assets/mod.rs @@ -318,5 +318,4 @@ fn textures( } #[cfg(test)] -#[path = "ped_assets_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/ped_assets_tests.rs b/crates/io/or-io/src/gta6/ped_assets/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/ped_assets_tests.rs rename to crates/io/or-io/src/gta6/ped_assets/tests.rs diff --git a/crates/io/or-io/src/gta6/ped_catalogue.rs b/crates/io/or-io/src/gta6/ped_catalogue/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/ped_catalogue.rs rename to crates/io/or-io/src/gta6/ped_catalogue/mod.rs index b9ca30abe..39e6d0ee5 100644 --- a/crates/io/or-io/src/gta6/ped_catalogue.rs +++ b/crates/io/or-io/src/gta6/ped_catalogue/mod.rs @@ -560,5 +560,4 @@ fn set_kit(kit: &Members) -> Result { } #[cfg(test)] -#[path = "ped_catalogue_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/ped_catalogue_tests.rs b/crates/io/or-io/src/gta6/ped_catalogue/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/ped_catalogue_tests.rs rename to crates/io/or-io/src/gta6/ped_catalogue/tests.rs diff --git a/crates/io/or-io/src/gta6/save_codec.rs b/crates/io/or-io/src/gta6/save/codec/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/save_codec.rs rename to crates/io/or-io/src/gta6/save/codec/mod.rs index 46d5fd02f..64e114d30 100644 --- a/crates/io/or-io/src/gta6/save_codec.rs +++ b/crates/io/or-io/src/gta6/save/codec/mod.rs @@ -419,5 +419,4 @@ fn u32_at(bytes: &[u8], at: usize) -> u32 { } #[cfg(test)] -#[path = "save_codec_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/save_codec_tests.rs b/crates/io/or-io/src/gta6/save/codec/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/save_codec_tests.rs rename to crates/io/or-io/src/gta6/save/codec/tests.rs diff --git a/crates/io/or-io/src/gta6/save_crypto.rs b/crates/io/or-io/src/gta6/save/crypto/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/save_crypto.rs rename to crates/io/or-io/src/gta6/save/crypto/mod.rs index bfa81cd4d..71d9e4be7 100644 --- a/crates/io/or-io/src/gta6/save_crypto.rs +++ b/crates/io/or-io/src/gta6/save/crypto/mod.rs @@ -304,5 +304,4 @@ impl SaveCipher { } #[cfg(test)] -#[path = "save_crypto_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/save_crypto_tests.rs b/crates/io/or-io/src/gta6/save/crypto/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/save_crypto_tests.rs rename to crates/io/or-io/src/gta6/save/crypto/tests.rs diff --git a/crates/io/or-io/src/gta6/save.rs b/crates/io/or-io/src/gta6/save/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/save.rs rename to crates/io/or-io/src/gta6/save/mod.rs index ad5ad01e6..91e685bfe 100644 --- a/crates/io/or-io/src/gta6/save.rs +++ b/crates/io/or-io/src/gta6/save/mod.rs @@ -4,6 +4,11 @@ //! Xbox build's `AsavHeader::ReadAndVerify` at 0x1428d0410 in `game_scarlett_master.exe`; and //! `SLAYER1`, a packed copy whose clear head is read and whose body is refused. +pub mod codec; +pub mod crypto; +pub mod stats; +pub mod story; + use std::ops::Range; use serde_json::Value; @@ -988,5 +993,4 @@ impl Slayer1 { } #[cfg(test)] -#[path = "save_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/save_stats.rs b/crates/io/or-io/src/gta6/save/stats/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/save_stats.rs rename to crates/io/or-io/src/gta6/save/stats/mod.rs index 6221e28b6..7d0d78b33 100644 --- a/crates/io/or-io/src/gta6/save_stats.rs +++ b/crates/io/or-io/src/gta6/save/stats/mod.rs @@ -172,5 +172,4 @@ pub(crate) fn key_texts(block: &Block) -> Vec { } #[cfg(test)] -#[path = "save_stats_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/save_stats_tests.rs b/crates/io/or-io/src/gta6/save/stats/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/save_stats_tests.rs rename to crates/io/or-io/src/gta6/save/stats/tests.rs diff --git a/crates/io/or-io/src/gta6/save_story.rs b/crates/io/or-io/src/gta6/save/story/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/save_story.rs rename to crates/io/or-io/src/gta6/save/story/mod.rs index 31c05d5ca..2eaefb4c2 100644 --- a/crates/io/or-io/src/gta6/save_story.rs +++ b/crates/io/or-io/src/gta6/save/story/mod.rs @@ -5,7 +5,7 @@ //! Every edit goes through [`Block`]'s own text edits, so it replaces or adds only the values it //! names. The layouts and constants were measured on saves of the Xbox build 1.0.2.1 and //! against the running game; a save the game wrote back after loading an edit is what proves an -//! edit here. The statistics block is another matter, see [`save_stats`](super::save_stats). +//! edit here. The statistics block is another matter, see [`save_stats`](super::stats). use serde_json::Value; @@ -707,5 +707,4 @@ pub fn add_discovery( } #[cfg(test)] -#[path = "save_story_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/save_story_tests.rs b/crates/io/or-io/src/gta6/save/story/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/save_story_tests.rs rename to crates/io/or-io/src/gta6/save/story/tests.rs diff --git a/crates/io/or-io/src/gta6/save_tests.rs b/crates/io/or-io/src/gta6/save/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/save_tests.rs rename to crates/io/or-io/src/gta6/save/tests.rs diff --git a/crates/io/or-io/src/gta6/script/cfg.rs b/crates/io/or-io/src/gta6/script/cfg/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/cfg.rs rename to crates/io/or-io/src/gta6/script/cfg/mod.rs index 055b1147a..acad8af1c 100644 --- a/crates/io/or-io/src/gta6/script/cfg.rs +++ b/crates/io/or-io/src/gta6/script/cfg/mod.rs @@ -704,5 +704,4 @@ fn always(cond: &Expr) -> bool { } #[cfg(test)] -#[path = "cfg_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/cfg_tests.rs b/crates/io/or-io/src/gta6/script/cfg/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/cfg_tests.rs rename to crates/io/or-io/src/gta6/script/cfg/tests.rs diff --git a/crates/io/or-io/src/gta6/script/compiled_asm.rs b/crates/io/or-io/src/gta6/script/compiled/disasm/asm/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/compiled_asm.rs rename to crates/io/or-io/src/gta6/script/compiled/disasm/asm/mod.rs index e0a5db92c..9a84dcbcd 100644 --- a/crates/io/or-io/src/gta6/script/compiled_asm.rs +++ b/crates/io/or-io/src/gta6/script/compiled/disasm/asm/mod.rs @@ -533,5 +533,4 @@ fn native_named(name: &str, natives: Option<&NativeAddresses>) -> Result Result<(), F } #[cfg(test)] -#[path = "compiled_edit_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/compiled_edit_tests.rs b/crates/io/or-io/src/gta6/script/compiled/edit/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/compiled_edit_tests.rs rename to crates/io/or-io/src/gta6/script/compiled/edit/tests.rs diff --git a/crates/io/or-io/src/gta6/script/compiled.rs b/crates/io/or-io/src/gta6/script/compiled/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/compiled.rs rename to crates/io/or-io/src/gta6/script/compiled/mod.rs index 72c3b10f5..f26517743 100644 --- a/crates/io/or-io/src/gta6/script/compiled.rs +++ b/crates/io/or-io/src/gta6/script/compiled/mod.rs @@ -241,11 +241,9 @@ impl<'a> Compiled<'a> { } /// A compiled script printed as a listing. -#[path = "disasm.rs"] pub mod disasm; /// A function of a compiled script laid again from a listing, and a native call pointed at another native. -#[path = "compiled_edit.rs"] pub mod edit; /// The tail call the code patcher writes over a function; a linear decode ends at it. diff --git a/crates/io/or-io/src/gta6/script/decode.rs b/crates/io/or-io/src/gta6/script/decode/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/decode.rs rename to crates/io/or-io/src/gta6/script/decode/mod.rs index 0dbd9f3e0..5d62cad53 100644 --- a/crates/io/or-io/src/gta6/script/decode.rs +++ b/crates/io/or-io/src/gta6/script/decode/mod.rs @@ -15,7 +15,6 @@ use super::opcode::{self, Op, Spec, Status, Type}; use super::program::{FunctionRow, Program}; use super::project::Project; -#[path = "decode_steps.rs"] mod steps; #[cfg(test)] @@ -334,5 +333,4 @@ pub fn text(program: &Program, names: &Names) -> Result { } #[cfg(test)] -#[path = "decode_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/decode_steps.rs b/crates/io/or-io/src/gta6/script/decode/steps.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/decode_steps.rs rename to crates/io/or-io/src/gta6/script/decode/steps.rs diff --git a/crates/io/or-io/src/gta6/script/decode_tests.rs b/crates/io/or-io/src/gta6/script/decode/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/decode_tests.rs rename to crates/io/or-io/src/gta6/script/decode/tests.rs diff --git a/crates/io/or-io/src/gta6/script/emit_access.rs b/crates/io/or-io/src/gta6/script/emit/access.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/emit_access.rs rename to crates/io/or-io/src/gta6/script/emit/access.rs diff --git a/crates/io/or-io/src/gta6/script/emit.rs b/crates/io/or-io/src/gta6/script/emit/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/emit.rs rename to crates/io/or-io/src/gta6/script/emit/mod.rs index dd478c47e..da61348fb 100644 --- a/crates/io/or-io/src/gta6/script/emit.rs +++ b/crates/io/or-io/src/gta6/script/emit/mod.rs @@ -16,7 +16,6 @@ use super::project::{types, FieldFacts}; use super::tree; use super::{Context, File, Level, Pass, Stats}; -#[path = "emit_access.rs"] mod access; use access::Access; @@ -1295,5 +1294,4 @@ fn indent(out: &mut String, depth: usize) { } #[cfg(test)] -#[path = "emit_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/emit_tests.rs b/crates/io/or-io/src/gta6/script/emit/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/emit_tests.rs rename to crates/io/or-io/src/gta6/script/emit/tests.rs diff --git a/crates/io/or-io/src/gta6/script/exec_members_tests.rs b/crates/io/or-io/src/gta6/script/exec/corpus/members.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/exec_members_tests.rs rename to crates/io/or-io/src/gta6/script/exec/corpus/members.rs diff --git a/crates/io/or-io/src/gta6/script/exec_corpus_tests.rs b/crates/io/or-io/src/gta6/script/exec/corpus/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/exec_corpus_tests.rs rename to crates/io/or-io/src/gta6/script/exec/corpus/mod.rs index f16fab3ce..4e091c55a 100644 --- a/crates/io/or-io/src/gta6/script/exec_corpus_tests.rs +++ b/crates/io/or-io/src/gta6/script/exec/corpus/mod.rs @@ -24,9 +24,7 @@ use crate::gta6::script::project::{self, index}; use crate::gta6::script::reparse::{self, ReparseError}; use crate::gta6::script::{decode, decompile, function_in, lift, print, Pass}; -#[path = "exec_members_tests.rs"] mod members; -#[path = "exec_async_tests.rs"] mod written; /// A folder of `*.ysc.cs`. diff --git a/crates/io/or-io/src/gta6/script/exec_async_tests.rs b/crates/io/or-io/src/gta6/script/exec/corpus/written.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/exec_async_tests.rs rename to crates/io/or-io/src/gta6/script/exec/corpus/written.rs diff --git a/crates/io/or-io/src/gta6/script/exec_inputs_tests.rs b/crates/io/or-io/src/gta6/script/exec/inputs.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/exec_inputs_tests.rs rename to crates/io/or-io/src/gta6/script/exec/inputs.rs diff --git a/crates/io/or-io/src/gta6/script/exec_tests.rs b/crates/io/or-io/src/gta6/script/exec/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/exec_tests.rs rename to crates/io/or-io/src/gta6/script/exec/mod.rs index 6be64ceb7..c3db79871 100644 --- a/crates/io/or-io/src/gta6/script/exec_tests.rs +++ b/crates/io/or-io/src/gta6/script/exec/mod.rs @@ -54,11 +54,8 @@ use std::collections::hash_map::DefaultHasher; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::hash::{Hash, Hasher}; -#[path = "exec_corpus_tests.rs"] mod corpus; -#[path = "exec_inputs_tests.rs"] mod inputs; -#[path = "exec_proofs_tests.rs"] mod proofs; const LOCALS: u64 = 0xA1 << 56; diff --git a/crates/io/or-io/src/gta6/script/exec_proofs_tests.rs b/crates/io/or-io/src/gta6/script/exec/proofs.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/exec_proofs_tests.rs rename to crates/io/or-io/src/gta6/script/exec/proofs.rs diff --git a/crates/io/or-io/src/gta6/script/ir.rs b/crates/io/or-io/src/gta6/script/ir/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/ir.rs rename to crates/io/or-io/src/gta6/script/ir/mod.rs index 7f7168ac5..17167fa81 100644 --- a/crates/io/or-io/src/gta6/script/ir.rs +++ b/crates/io/or-io/src/gta6/script/ir/mod.rs @@ -1073,5 +1073,4 @@ pub struct Head { } #[cfg(test)] -#[path = "ir_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/ir_tests.rs b/crates/io/or-io/src/gta6/script/ir/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/ir_tests.rs rename to crates/io/or-io/src/gta6/script/ir/tests.rs diff --git a/crates/io/or-io/src/gta6/script/lift.rs b/crates/io/or-io/src/gta6/script/lift/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/lift.rs rename to crates/io/or-io/src/gta6/script/lift/mod.rs index 198ac8857..9ed0711dd 100644 --- a/crates/io/or-io/src/gta6/script/lift.rs +++ b/crates/io/or-io/src/gta6/script/lift/mod.rs @@ -26,7 +26,6 @@ use super::project::Project; use super::tree; use super::{Context, DecompileError, Names, Output, Stats}; -#[path = "lift_sized.rs"] mod sizing; #[cfg(test)] @@ -1567,5 +1566,4 @@ fn assemble(function: u32, drafts: Vec) -> Result { } #[cfg(test)] -#[path = "lift_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/lift_sized.rs b/crates/io/or-io/src/gta6/script/lift/sizing.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/lift_sized.rs rename to crates/io/or-io/src/gta6/script/lift/sizing.rs diff --git a/crates/io/or-io/src/gta6/script/lift_tests.rs b/crates/io/or-io/src/gta6/script/lift/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/lift_tests.rs rename to crates/io/or-io/src/gta6/script/lift/tests.rs diff --git a/crates/io/or-io/src/gta6/script/listing.rs b/crates/io/or-io/src/gta6/script/listing/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/listing.rs rename to crates/io/or-io/src/gta6/script/listing/mod.rs index 1f836497f..95adbd420 100644 --- a/crates/io/or-io/src/gta6/script/listing.rs +++ b/crates/io/or-io/src/gta6/script/listing/mod.rs @@ -1796,5 +1796,4 @@ fn negated(e: Expr) -> Expr { } #[cfg(test)] -#[path = "listing_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/listing_tests.rs b/crates/io/or-io/src/gta6/script/listing/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/listing_tests.rs rename to crates/io/or-io/src/gta6/script/listing/tests.rs diff --git a/crates/io/or-io/src/gta6/script/mod.rs b/crates/io/or-io/src/gta6/script/mod.rs index 1965f6aab..9e4045c12 100644 --- a/crates/io/or-io/src/gta6/script/mod.rs +++ b/crates/io/or-io/src/gta6/script/mod.rs @@ -505,13 +505,10 @@ fn reading(kind: ExprSugar) -> usize { } #[cfg(test)] -#[path = "exec_tests.rs"] mod exec; #[cfg(test)] -#[path = "sample_tests.rs"] mod sample; #[cfg(test)] -#[path = "mod_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/names_likely.rs b/crates/io/or-io/src/gta6/script/names/likely/mod.rs similarity index 98% rename from crates/io/or-io/src/gta6/script/names_likely.rs rename to crates/io/or-io/src/gta6/script/names/likely/mod.rs index 62d42f750..66d311d20 100644 --- a/crates/io/or-io/src/gta6/script/names_likely.rs +++ b/crates/io/or-io/src/gta6/script/names/likely/mod.rs @@ -44,5 +44,4 @@ pub(super) fn text(texts: &HashMap>, hash: u32) -> Option<&s } #[cfg(test)] -#[path = "names_likely_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/names_likely_tests.rs b/crates/io/or-io/src/gta6/script/names/likely/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/names_likely_tests.rs rename to crates/io/or-io/src/gta6/script/names/likely/tests.rs diff --git a/crates/io/or-io/src/gta6/script/names.rs b/crates/io/or-io/src/gta6/script/names/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/names.rs rename to crates/io/or-io/src/gta6/script/names/mod.rs index 7e0582b47..0becf1ed8 100644 --- a/crates/io/or-io/src/gta6/script/names.rs +++ b/crates/io/or-io/src/gta6/script/names/mod.rs @@ -32,15 +32,10 @@ use crate::gta5::script::natives::{NativeDb, NativeName}; use crate::gta6::hash::literal_hash64 as murmur_low; use crate::hash::literal_string_hash; -#[path = "names_likely.rs"] mod likely; -#[path = "names_natives.rs"] pub mod natives; -#[path = "names_search.rs"] pub mod search; -#[path = "names_slots.rs"] pub mod slots; -#[path = "names_words.rs"] pub mod words; pub use natives::{NativeParameter, NativeSignature, NativeType}; @@ -1267,5 +1262,4 @@ fn decimal(digits: &str) -> Option { } #[cfg(test)] -#[path = "names_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/names_natives.rs b/crates/io/or-io/src/gta6/script/names/natives/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/names_natives.rs rename to crates/io/or-io/src/gta6/script/names/natives/mod.rs index 805350164..87a0a1ae4 100644 --- a/crates/io/or-io/src/gta6/script/names_natives.rs +++ b/crates/io/or-io/src/gta6/script/names/natives/mod.rs @@ -198,5 +198,4 @@ impl Names { } #[cfg(test)] -#[path = "names_natives_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/names_natives_tests.rs b/crates/io/or-io/src/gta6/script/names/natives/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/names_natives_tests.rs rename to crates/io/or-io/src/gta6/script/names/natives/tests.rs diff --git a/crates/io/or-io/src/gta6/script/names_search.rs b/crates/io/or-io/src/gta6/script/names/search/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/names_search.rs rename to crates/io/or-io/src/gta6/script/names/search/mod.rs index 8902dc7e8..e39ac9286 100644 --- a/crates/io/or-io/src/gta6/script/names_search.rs +++ b/crates/io/or-io/src/gta6/script/names/search/mod.rs @@ -610,5 +610,4 @@ const LOWER_CASE: u32 = 2; const LOWER: u32 = 0xAA; #[cfg(test)] -#[path = "names_search_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/names_search_tests.rs b/crates/io/or-io/src/gta6/script/names/search/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/names_search_tests.rs rename to crates/io/or-io/src/gta6/script/names/search/tests.rs diff --git a/crates/io/or-io/src/gta6/script/names_slots.rs b/crates/io/or-io/src/gta6/script/names/slots/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/names_slots.rs rename to crates/io/or-io/src/gta6/script/names/slots/mod.rs index 68e35ab41..8fe27dcca 100644 --- a/crates/io/or-io/src/gta6/script/names_slots.rs +++ b/crates/io/or-io/src/gta6/script/names/slots/mod.rs @@ -1041,5 +1041,4 @@ fn identifier(name: &str) -> bool { } #[cfg(test)] -#[path = "names_slots_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/names_slots_tests.rs b/crates/io/or-io/src/gta6/script/names/slots/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/names_slots_tests.rs rename to crates/io/or-io/src/gta6/script/names/slots/tests.rs diff --git a/crates/io/or-io/src/gta6/script/names_tests.rs b/crates/io/or-io/src/gta6/script/names/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/names_tests.rs rename to crates/io/or-io/src/gta6/script/names/tests.rs diff --git a/crates/io/or-io/src/gta6/script/names_words.rs b/crates/io/or-io/src/gta6/script/names/words/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/names_words.rs rename to crates/io/or-io/src/gta6/script/names/words/mod.rs index 6f61e85f7..05d8d6e70 100644 --- a/crates/io/or-io/src/gta6/script/names_words.rs +++ b/crates/io/or-io/src/gta6/script/names/words/mod.rs @@ -133,5 +133,4 @@ pub fn bundled() -> impl Iterator { } #[cfg(test)] -#[path = "names_words_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/names_words.txt b/crates/io/or-io/src/gta6/script/names/words/names_words.txt similarity index 100% rename from crates/io/or-io/src/gta6/script/names_words.txt rename to crates/io/or-io/src/gta6/script/names/words/names_words.txt diff --git a/crates/io/or-io/src/gta6/script/names_words_tests.rs b/crates/io/or-io/src/gta6/script/names/words/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/names_words_tests.rs rename to crates/io/or-io/src/gta6/script/names/words/tests.rs diff --git a/crates/io/or-io/src/gta6/script/native_addresses.rs b/crates/io/or-io/src/gta6/script/native_addresses/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/native_addresses.rs rename to crates/io/or-io/src/gta6/script/native_addresses/mod.rs index d76d63ba0..6c7b0ea91 100644 --- a/crates/io/or-io/src/gta6/script/native_addresses.rs +++ b/crates/io/or-io/src/gta6/script/native_addresses/mod.rs @@ -307,5 +307,4 @@ fn file_name(path: &Path) -> String { } #[cfg(test)] -#[path = "native_addresses_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/native_addresses_tests.rs b/crates/io/or-io/src/gta6/script/native_addresses/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/native_addresses_tests.rs rename to crates/io/or-io/src/gta6/script/native_addresses/tests.rs diff --git a/crates/io/or-io/src/gta6/script/opcode.rs b/crates/io/or-io/src/gta6/script/opcode/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/opcode.rs rename to crates/io/or-io/src/gta6/script/opcode/mod.rs index 29d1599d8..337fce39d 100644 --- a/crates/io/or-io/src/gta6/script/opcode.rs +++ b/crates/io/or-io/src/gta6/script/opcode/mod.rs @@ -7,7 +7,6 @@ use super::ir::{BinOp, Callee, Expr, Kind, Scalar, StoreKind, UnOp, Var, VmType}; -#[path = "opcode_table.rs"] mod table; /// One step of an instruction on the evaluation stack; every count is in cells. @@ -397,5 +396,4 @@ pub fn builtin_slot(ty: u32, slot: u32) -> Option { } #[cfg(test)] -#[path = "opcode_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/opcode_table.rs b/crates/io/or-io/src/gta6/script/opcode/table.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/opcode_table.rs rename to crates/io/or-io/src/gta6/script/opcode/table.rs diff --git a/crates/io/or-io/src/gta6/script/opcode_tests.rs b/crates/io/or-io/src/gta6/script/opcode/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/opcode_tests.rs rename to crates/io/or-io/src/gta6/script/opcode/tests.rs diff --git a/crates/io/or-io/src/gta6/script/options.rs b/crates/io/or-io/src/gta6/script/options/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/options.rs rename to crates/io/or-io/src/gta6/script/options/mod.rs index ad5509b72..17f27da33 100644 --- a/crates/io/or-io/src/gta6/script/options.rs +++ b/crates/io/or-io/src/gta6/script/options/mod.rs @@ -476,5 +476,4 @@ impl Options { } #[cfg(test)] -#[path = "options_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/options_tests.rs b/crates/io/or-io/src/gta6/script/options/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/options_tests.rs rename to crates/io/or-io/src/gta6/script/options/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/aggregates_kinds.rs b/crates/io/or-io/src/gta6/script/passes/aggregates/kinds/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/aggregates_kinds.rs rename to crates/io/or-io/src/gta6/script/passes/aggregates/kinds/mod.rs index 4197d2144..2b1857cb3 100644 --- a/crates/io/or-io/src/gta6/script/passes/aggregates_kinds.rs +++ b/crates/io/or-io/src/gta6/script/passes/aggregates/kinds/mod.rs @@ -580,5 +580,4 @@ pub fn copied_kinds(f: &mut cfg::Function, cx: &Context<'_>, _stats: &mut Stats) } #[cfg(test)] -#[path = "aggregates_kinds_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/aggregates_kinds_tests.rs b/crates/io/or-io/src/gta6/script/passes/aggregates/kinds/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/aggregates_kinds_tests.rs rename to crates/io/or-io/src/gta6/script/passes/aggregates/kinds/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/aggregates.rs b/crates/io/or-io/src/gta6/script/passes/aggregates/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/aggregates.rs rename to crates/io/or-io/src/gta6/script/passes/aggregates/mod.rs index 6b7b070ef..efd30f30a 100644 --- a/crates/io/or-io/src/gta6/script/passes/aggregates.rs +++ b/crates/io/or-io/src/gta6/script/passes/aggregates/mod.rs @@ -18,7 +18,6 @@ use crate::gta6::script::ir::{ use crate::gta6::script::project::{Project, Signature}; use crate::gta6::script::{Context, Pass, Stats}; -#[path = "aggregates_kinds.rs"] mod kinds; pub use kinds::copied_kinds; @@ -1611,5 +1610,4 @@ pub(crate) fn apply(f: &mut cfg::Function, project: &Project) -> Made { } #[cfg(test)] -#[path = "aggregates_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/aggregates_tests.rs b/crates/io/or-io/src/gta6/script/passes/aggregates/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/aggregates_tests.rs rename to crates/io/or-io/src/gta6/script/passes/aggregates/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_assigned.rs b/crates/io/or-io/src/gta6/script/passes/async_await/assigned/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/async_await_assigned.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/assigned/mod.rs index 341553c7f..c84e83fcf 100644 --- a/crates/io/or-io/src/gta6/script/passes/async_await_assigned.rs +++ b/crates/io/or-io/src/gta6/script/passes/async_await/assigned/mod.rs @@ -367,5 +367,4 @@ impl Walk<'_> { } #[cfg(test)] -#[path = "async_await_assigned_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_assigned_tests.rs b/crates/io/or-io/src/gta6/script/passes/async_await/assigned/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_assigned_tests.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/assigned/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_across.rs b/crates/io/or-io/src/gta6/script/passes/async_await/calls/across.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_across.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/calls/across.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_calls.rs b/crates/io/or-io/src/gta6/script/passes/async_await/calls/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/async_await_calls.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/calls/mod.rs index e68559a14..17a7fa6de 100644 --- a/crates/io/or-io/src/gta6/script/passes/async_await_calls.rs +++ b/crates/io/or-io/src/gta6/script/passes/async_await/calls/mod.rs @@ -27,9 +27,7 @@ use super::kick::{self, asked_of_builder, blank, compilers_own, simple_of, start use super::place::awaiter; use super::{field_read, place, rooted, unwide, Base, Held, Reach, BUILDER, FIELDS, RUNNING, TASK}; -#[path = "async_await_across.rs"] mod across; -#[path = "async_await_twin.rs"] mod twin; pub use across::{ across, agreed, iterators_unseen, twins, unlifted_names, Across, Calls, Candidate, Kicked, diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_twin.rs b/crates/io/or-io/src/gta6/script/passes/async_await/calls/twin/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/async_await_twin.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/calls/twin/mod.rs index a2c058813..ee19e5cd1 100644 --- a/crates/io/or-io/src/gta6/script/passes/async_await_twin.rs +++ b/crates/io/or-io/src/gta6/script/passes/async_await/calls/twin/mod.rs @@ -470,5 +470,4 @@ fn renamed(line: &str, names: &mut BTreeMap) -> String { } #[cfg(test)] -#[path = "async_await_twin_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_twin_tests.rs b/crates/io/or-io/src/gta6/script/passes/async_await/calls/twin/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_twin_tests.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/calls/twin/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_ends.rs b/crates/io/or-io/src/gta6/script/passes/async_await/ends.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_ends.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/ends.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_frame.rs b/crates/io/or-io/src/gta6/script/passes/async_await/frame.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_frame.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/frame.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_guard.rs b/crates/io/or-io/src/gta6/script/passes/async_await/guard.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_guard.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/guard.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_hoist.rs b/crates/io/or-io/src/gta6/script/passes/async_await/hoist.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_hoist.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/hoist.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_iterated.rs b/crates/io/or-io/src/gta6/script/passes/async_await/iterated/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/async_await_iterated.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/iterated/mod.rs index f3995263d..ff4450d29 100644 --- a/crates/io/or-io/src/gta6/script/passes/async_await_iterated.rs +++ b/crates/io/or-io/src/gta6/script/passes/async_await/iterated/mod.rs @@ -1261,5 +1261,4 @@ fn remove_class(unit: &mut Unit, key: TypeKey) { } #[cfg(test)] -#[path = "async_await_iterated_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_iterated_tests.rs b/crates/io/or-io/src/gta6/script/passes/async_await/iterated/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_iterated_tests.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/iterated/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_kick.rs b/crates/io/or-io/src/gta6/script/passes/async_await/kick.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_kick.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/kick.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await.rs b/crates/io/or-io/src/gta6/script/passes/async_await/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/async_await.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/mod.rs index bbc6d1986..d224ab4da 100644 --- a/crates/io/or-io/src/gta6/script/passes/async_await.rs +++ b/crates/io/or-io/src/gta6/script/passes/async_await/mod.rs @@ -24,25 +24,15 @@ // where `iterators` is on. // ⚠ `wait` switches nothing: a script's wait is an await like any other. -#[path = "async_await_assigned.rs"] mod assigned; -#[path = "async_await_calls.rs"] mod calls; -#[path = "async_await_ends.rs"] mod ends; -#[path = "async_await_frame.rs"] mod frame; -#[path = "async_await_guard.rs"] mod guard; -#[path = "async_await_hoist.rs"] mod hoist; -#[path = "async_await_iterated.rs"] mod iterated; -#[path = "async_await_kick.rs"] mod kick; -#[path = "async_await_place.rs"] mod place; -#[path = "async_await_yield.rs"] mod yields; use std::collections::{BTreeMap, BTreeSet}; @@ -2070,5 +2060,4 @@ fn sound(cfg: &Cfg, machine: &Machine, reach: Reach) -> Result<(), Decline> { } #[cfg(test)] -#[path = "async_await_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_place.rs b/crates/io/or-io/src/gta6/script/passes/async_await/place/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/async_await_place.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/place/mod.rs index b314ebdee..48e589b2a 100644 --- a/crates/io/or-io/src/gta6/script/passes/async_await_place.rs +++ b/crates/io/or-io/src/gta6/script/passes/async_await/place/mod.rs @@ -346,5 +346,4 @@ pub(super) fn tasks(body: &mut Vec) { } #[cfg(test)] -#[path = "async_await_place_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_place_tests.rs b/crates/io/or-io/src/gta6/script/passes/async_await/place/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_place_tests.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/place/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_calls_tests.rs b/crates/io/or-io/src/gta6/script/passes/async_await/tests/calling.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_calls_tests.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/tests/calling.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_hide_tests.rs b/crates/io/or-io/src/gta6/script/passes/async_await/tests/hide.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_hide_tests.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/tests/hide.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_hoist_tests.rs b/crates/io/or-io/src/gta6/script/passes/async_await/tests/hoisting.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_hoist_tests.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/tests/hoisting.rs diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_tests.rs b/crates/io/or-io/src/gta6/script/passes/async_await/tests/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/async_await_tests.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/tests/mod.rs index 543e93dc8..cbdb7c4a3 100644 --- a/crates/io/or-io/src/gta6/script/passes/async_await_tests.rs +++ b/crates/io/or-io/src/gta6/script/passes/async_await/tests/mod.rs @@ -1019,13 +1019,10 @@ fn a_machine_of_a_call_made_in_line_read_after_the_await_leaves_the_machine() { assert!(machine.is_none()); } -#[path = "async_await_hide_tests.rs"] mod hide; -#[path = "async_await_hoist_tests.rs"] mod hoisting; -#[path = "async_await_calls_tests.rs"] mod calling; #[test] diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_yield.rs b/crates/io/or-io/src/gta6/script/passes/async_await/yields/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/async_await_yield.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/yields/mod.rs index c592405fe..ed41c837b 100644 --- a/crates/io/or-io/src/gta6/script/passes/async_await_yield.rs +++ b/crates/io/or-io/src/gta6/script/passes/async_await/yields/mod.rs @@ -872,5 +872,4 @@ pub(super) fn breaks_out(body: &mut Vec, spare: &mut u32) { } #[cfg(test)] -#[path = "async_await_yield_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/async_await_yield_tests.rs b/crates/io/or-io/src/gta6/script/passes/async_await/yields/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/async_await_yield_tests.rs rename to crates/io/or-io/src/gta6/script/passes/async_await/yields/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/classes_fields.rs b/crates/io/or-io/src/gta6/script/passes/classes/fields/mod.rs similarity index 98% rename from crates/io/or-io/src/gta6/script/passes/classes_fields.rs rename to crates/io/or-io/src/gta6/script/passes/classes/fields/mod.rs index 349e87fdc..56c97897a 100644 --- a/crates/io/or-io/src/gta6/script/passes/classes_fields.rs +++ b/crates/io/or-io/src/gta6/script/passes/classes/fields/mod.rs @@ -80,5 +80,4 @@ pub(super) fn field_type( } #[cfg(test)] -#[path = "classes_fields_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/classes_fields_tests.rs b/crates/io/or-io/src/gta6/script/passes/classes/fields/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/classes_fields_tests.rs rename to crates/io/or-io/src/gta6/script/passes/classes/fields/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/classes_frame.rs b/crates/io/or-io/src/gta6/script/passes/classes/frame/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/classes_frame.rs rename to crates/io/or-io/src/gta6/script/passes/classes/frame/mod.rs index 2c8758d2c..899954b19 100644 --- a/crates/io/or-io/src/gta6/script/passes/classes_frame.rs +++ b/crates/io/or-io/src/gta6/script/passes/classes/frame/mod.rs @@ -262,5 +262,4 @@ fn own(var: Var, head: &Head) -> u64 { } #[cfg(test)] -#[path = "classes_frame_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/classes_frame_tests.rs b/crates/io/or-io/src/gta6/script/passes/classes/frame/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/classes_frame_tests.rs rename to crates/io/or-io/src/gta6/script/passes/classes/frame/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/classes.rs b/crates/io/or-io/src/gta6/script/passes/classes/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/classes.rs rename to crates/io/or-io/src/gta6/script/passes/classes/mod.rs index 10a0e70d4..29ab79d00 100644 --- a/crates/io/or-io/src/gta6/script/passes/classes.rs +++ b/crates/io/or-io/src/gta6/script/passes/classes/mod.rs @@ -42,16 +42,12 @@ use crate::hash::literal_string_hash; use super::sugar_expressions::Reached; -#[path = "classes_properties.rs"] mod properties; -#[path = "classes_typed.rs"] mod typed; -#[path = "classes_frame.rs"] mod frame; -#[path = "classes_fields.rs"] mod fields; use properties::{accessed, Stands}; @@ -2178,5 +2174,4 @@ fn constructions(body: &[Stmt]) -> usize { } #[cfg(test)] -#[path = "classes_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/classes_properties.rs b/crates/io/or-io/src/gta6/script/passes/classes/properties.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/classes_properties.rs rename to crates/io/or-io/src/gta6/script/passes/classes/properties.rs diff --git a/crates/io/or-io/src/gta6/script/passes/classes_tests.rs b/crates/io/or-io/src/gta6/script/passes/classes/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/classes_tests.rs rename to crates/io/or-io/src/gta6/script/passes/classes/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/classes_typed.rs b/crates/io/or-io/src/gta6/script/passes/classes/typed/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/classes_typed.rs rename to crates/io/or-io/src/gta6/script/passes/classes/typed/mod.rs index dac5205ff..e7f26dea8 100644 --- a/crates/io/or-io/src/gta6/script/passes/classes_typed.rs +++ b/crates/io/or-io/src/gta6/script/passes/classes/typed/mod.rs @@ -140,5 +140,4 @@ pub(super) fn needs( } #[cfg(test)] -#[path = "classes_typed_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/classes_typed_tests.rs b/crates/io/or-io/src/gta6/script/passes/classes/typed/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/classes_typed_tests.rs rename to crates/io/or-io/src/gta6/script/passes/classes/typed/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/closures.rs b/crates/io/or-io/src/gta6/script/passes/closures/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/closures.rs rename to crates/io/or-io/src/gta6/script/passes/closures/mod.rs index 9b017d5a1..32a682431 100644 --- a/crates/io/or-io/src/gta6/script/passes/closures.rs +++ b/crates/io/or-io/src/gta6/script/passes/closures/mod.rs @@ -1634,5 +1634,4 @@ fn own_vars(f: &tree::Function) -> BTreeSet { } #[cfg(test)] -#[path = "closures_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/closures_tests.rs b/crates/io/or-io/src/gta6/script/passes/closures/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/closures_tests.rs rename to crates/io/or-io/src/gta6/script/passes/closures/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/coalesce.rs b/crates/io/or-io/src/gta6/script/passes/coalesce/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/coalesce.rs rename to crates/io/or-io/src/gta6/script/passes/coalesce/mod.rs index 7623a3de5..d2b315056 100644 --- a/crates/io/or-io/src/gta6/script/passes/coalesce.rs +++ b/crates/io/or-io/src/gta6/script/passes/coalesce/mod.rs @@ -495,5 +495,4 @@ fn sweep(f: &mut cfg::Function, constants: bool, copies: bool) -> bool { } #[cfg(test)] -#[path = "coalesce_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/coalesce_tests.rs b/crates/io/or-io/src/gta6/script/passes/coalesce/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/coalesce_tests.rs rename to crates/io/or-io/src/gta6/script/passes/coalesce/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/default_last.rs b/crates/io/or-io/src/gta6/script/passes/default_last/mod.rs similarity index 98% rename from crates/io/or-io/src/gta6/script/passes/default_last.rs rename to crates/io/or-io/src/gta6/script/passes/default_last/mod.rs index a5f1b2c1d..3845f4795 100644 --- a/crates/io/or-io/src/gta6/script/passes/default_last.rs +++ b/crates/io/or-io/src/gta6/script/passes/default_last/mod.rs @@ -45,5 +45,4 @@ fn moved(cases: &mut Vec) { } #[cfg(test)] -#[path = "default_last_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/default_last_tests.rs b/crates/io/or-io/src/gta6/script/passes/default_last/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/default_last_tests.rs rename to crates/io/or-io/src/gta6/script/passes/default_last/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/fields.rs b/crates/io/or-io/src/gta6/script/passes/fields/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/fields.rs rename to crates/io/or-io/src/gta6/script/passes/fields/mod.rs index b771a12b0..f802dec6b 100644 --- a/crates/io/or-io/src/gta6/script/passes/fields.rs +++ b/crates/io/or-io/src/gta6/script/passes/fields/mod.rs @@ -1108,5 +1108,4 @@ fn apply_with(f: &mut tree::Function, project: &Project, layouts: bool) -> Found } #[cfg(test)] -#[path = "fields_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/fields_tests.rs b/crates/io/or-io/src/gta6/script/passes/fields/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/fields_tests.rs rename to crates/io/or-io/src/gta6/script/passes/fields/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/forward_flow.rs b/crates/io/or-io/src/gta6/script/passes/forward/flow.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/forward_flow.rs rename to crates/io/or-io/src/gta6/script/passes/forward/flow.rs diff --git a/crates/io/or-io/src/gta6/script/passes/forward.rs b/crates/io/or-io/src/gta6/script/passes/forward/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/forward.rs rename to crates/io/or-io/src/gta6/script/passes/forward/mod.rs index d37e29fc5..7b6902028 100644 --- a/crates/io/or-io/src/gta6/script/passes/forward.rs +++ b/crates/io/or-io/src/gta6/script/passes/forward/mod.rs @@ -5,7 +5,6 @@ //! only where nothing between them can write the place: no call, no store through an address //! that may be the same, no address of it handed out. -#[path = "forward_flow.rs"] pub(super) mod flow; use std::collections::{HashMap, HashSet}; @@ -1111,5 +1110,4 @@ fn repeated(f: &mut cfg::Function) -> bool { } #[cfg(test)] -#[path = "forward_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/forward_tests.rs b/crates/io/or-io/src/gta6/script/passes/forward/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/forward_tests.rs rename to crates/io/or-io/src/gta6/script/passes/forward/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/interproc.rs b/crates/io/or-io/src/gta6/script/passes/interproc/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/interproc.rs rename to crates/io/or-io/src/gta6/script/passes/interproc/mod.rs index c05baf53e..aad5de744 100644 --- a/crates/io/or-io/src/gta6/script/passes/interproc.rs +++ b/crates/io/or-io/src/gta6/script/passes/interproc/mod.rs @@ -509,5 +509,4 @@ fn rewrite(top: &mut Expr, whole: bool, kinds: &Kinds<'_>, done: &mut Applied) { } #[cfg(test)] -#[path = "interproc_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/interproc_tests.rs b/crates/io/or-io/src/gta6/script/passes/interproc/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/interproc_tests.rs rename to crates/io/or-io/src/gta6/script/passes/interproc/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/names_across.rs b/crates/io/or-io/src/gta6/script/passes/names/across/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/names_across.rs rename to crates/io/or-io/src/gta6/script/passes/names/across/mod.rs index 25fa752a5..0815af61f 100644 --- a/crates/io/or-io/src/gta6/script/passes/names_across.rs +++ b/crates/io/or-io/src/gta6/script/passes/names/across/mod.rs @@ -350,5 +350,4 @@ fn each_return<'a>(body: &'a [tree::Stmt], f: &mut impl FnMut(&'a Expr)) { } #[cfg(test)] -#[path = "names_across_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/names_across_tests.rs b/crates/io/or-io/src/gta6/script/passes/names/across/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/names_across_tests.rs rename to crates/io/or-io/src/gta6/script/passes/names/across/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/names.rs b/crates/io/or-io/src/gta6/script/passes/names/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/names.rs rename to crates/io/or-io/src/gta6/script/passes/names/mod.rs index 5593cab6d..edddf2bbe 100644 --- a/crates/io/or-io/src/gta6/script/passes/names.rs +++ b/crates/io/or-io/src/gta6/script/passes/names/mod.rs @@ -1838,18 +1838,13 @@ const KEYWORDS: &[&str] = &[ "while", ]; -#[path = "names_stated.rs"] pub(crate) mod stated; -#[path = "names_across.rs"] pub mod across; -#[path = "names_shapes.rs"] mod shapes; -#[path = "names_order.rs"] mod order; #[cfg(test)] -#[path = "names_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/names_order.rs b/crates/io/or-io/src/gta6/script/passes/names/order/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/names_order.rs rename to crates/io/or-io/src/gta6/script/passes/names/order/mod.rs index 662bd1c9c..548600ec1 100644 --- a/crates/io/or-io/src/gta6/script/passes/names_order.rs +++ b/crates/io/or-io/src/gta6/script/passes/names/order/mod.rs @@ -151,5 +151,4 @@ fn simple(s: &Stmt, f: &mut dyn FnMut(Var)) { } #[cfg(test)] -#[path = "names_order_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/names_order_tests.rs b/crates/io/or-io/src/gta6/script/passes/names/order/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/names_order_tests.rs rename to crates/io/or-io/src/gta6/script/passes/names/order/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/names_shapes.rs b/crates/io/or-io/src/gta6/script/passes/names/shapes/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/names_shapes.rs rename to crates/io/or-io/src/gta6/script/passes/names/shapes/mod.rs index 7710977ed..c6ed8a30e 100644 --- a/crates/io/or-io/src/gta6/script/passes/names_shapes.rs +++ b/crates/io/or-io/src/gta6/script/passes/names/shapes/mod.rs @@ -197,5 +197,4 @@ fn nested(stmt: &tree::Stmt) -> Vec<&[tree::Stmt]> { } #[cfg(test)] -#[path = "names_shapes_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/names_shapes_tests.rs b/crates/io/or-io/src/gta6/script/passes/names/shapes/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/names_shapes_tests.rs rename to crates/io/or-io/src/gta6/script/passes/names/shapes/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/names_stated.rs b/crates/io/or-io/src/gta6/script/passes/names/stated/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/names_stated.rs rename to crates/io/or-io/src/gta6/script/passes/names/stated/mod.rs index 931c20645..3b7107315 100644 --- a/crates/io/or-io/src/gta6/script/passes/names_stated.rs +++ b/crates/io/or-io/src/gta6/script/passes/names/stated/mod.rs @@ -272,5 +272,4 @@ pub(super) fn type_word(ty: &str) -> Option { } #[cfg(test)] -#[path = "names_stated_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/names_stated_tests.rs b/crates/io/or-io/src/gta6/script/passes/names/stated/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/names_stated_tests.rs rename to crates/io/or-io/src/gta6/script/passes/names/stated/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/names_tests.rs b/crates/io/or-io/src/gta6/script/passes/names/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/names_tests.rs rename to crates/io/or-io/src/gta6/script/passes/names/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/structure_cases.rs b/crates/io/or-io/src/gta6/script/passes/structure/cases.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/structure_cases.rs rename to crates/io/or-io/src/gta6/script/passes/structure/cases.rs diff --git a/crates/io/or-io/src/gta6/script/passes/structure_cond.rs b/crates/io/or-io/src/gta6/script/passes/structure/cond/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/structure_cond.rs rename to crates/io/or-io/src/gta6/script/passes/structure/cond/mod.rs index 3c01e3b90..a9ddfc8cf 100644 --- a/crates/io/or-io/src/gta6/script/passes/structure_cond.rs +++ b/crates/io/or-io/src/gta6/script/passes/structure/cond/mod.rs @@ -685,5 +685,4 @@ fn truths_in(list: &mut Vec, depth: usize, returns_truth: bool) { } #[cfg(test)] -#[path = "structure_cond_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/structure_cond_tests.rs b/crates/io/or-io/src/gta6/script/passes/structure/cond/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/structure_cond_tests.rs rename to crates/io/or-io/src/gta6/script/passes/structure/cond/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/structure_exits.rs b/crates/io/or-io/src/gta6/script/passes/structure/exits/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/structure_exits.rs rename to crates/io/or-io/src/gta6/script/passes/structure/exits/mod.rs index c318e9c42..34c52c56d 100644 --- a/crates/io/or-io/src/gta6/script/passes/structure_exits.rs +++ b/crates/io/or-io/src/gta6/script/passes/structure/exits/mod.rs @@ -1489,5 +1489,4 @@ pub(super) fn returned_everywhere( } #[cfg(test)] -#[path = "structure_exits_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/structure_exits_tests.rs b/crates/io/or-io/src/gta6/script/passes/structure/exits/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/structure_exits_tests.rs rename to crates/io/or-io/src/gta6/script/passes/structure/exits/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/structure_graph.rs b/crates/io/or-io/src/gta6/script/passes/structure/graph.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/structure_graph.rs rename to crates/io/or-io/src/gta6/script/passes/structure/graph.rs diff --git a/crates/io/or-io/src/gta6/script/passes/structure_inlined.rs b/crates/io/or-io/src/gta6/script/passes/structure/inlined/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/structure_inlined.rs rename to crates/io/or-io/src/gta6/script/passes/structure/inlined/mod.rs index 887f4ba50..7c13ca1a9 100644 --- a/crates/io/or-io/src/gta6/script/passes/structure_inlined.rs +++ b/crates/io/or-io/src/gta6/script/passes/structure/inlined/mod.rs @@ -1070,5 +1070,4 @@ fn numbered(body: &mut [Stmt]) { } #[cfg(test)] -#[path = "structure_inlined_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/structure_inlined_tests.rs b/crates/io/or-io/src/gta6/script/passes/structure/inlined/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/structure_inlined_tests.rs rename to crates/io/or-io/src/gta6/script/passes/structure/inlined/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/structure_layout.rs b/crates/io/or-io/src/gta6/script/passes/structure/layout.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/structure_layout.rs rename to crates/io/or-io/src/gta6/script/passes/structure/layout.rs diff --git a/crates/io/or-io/src/gta6/script/passes/structure.rs b/crates/io/or-io/src/gta6/script/passes/structure/mod.rs similarity index 98% rename from crates/io/or-io/src/gta6/script/passes/structure.rs rename to crates/io/or-io/src/gta6/script/passes/structure/mod.rs index a1fb35e7d..510cacdab 100644 --- a/crates/io/or-io/src/gta6/script/passes/structure.rs +++ b/crates/io/or-io/src/gta6/script/passes/structure/mod.rs @@ -28,21 +28,13 @@ // The pass `conditions` writes an `if` whose two arms only give one variable a truth as that // assignment (`x = a || b`, `x = c ? 1 : 0`), and an `if` that holds only an `if` as `a && b`. -#[path = "structure_cases.rs"] mod cases; -#[path = "structure_cond.rs"] mod cond; -#[path = "structure_exits.rs"] mod exits; -#[path = "structure_graph.rs"] mod graph; -#[path = "structure_inlined.rs"] mod inlined; -#[path = "structure_layout.rs"] mod layout; -#[path = "structure_region.rs"] mod region; -#[path = "structure_tails.rs"] mod tails; pub(crate) use self::inlined::{ broken, case_heads, entered, name as inlined_name, outlined, INLINED_SAID, @@ -363,5 +355,4 @@ fn plain_defaults(body: &mut Vec) { } #[cfg(test)] -#[path = "structure_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/structure_region.rs b/crates/io/or-io/src/gta6/script/passes/structure/region.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/structure_region.rs rename to crates/io/or-io/src/gta6/script/passes/structure/region.rs diff --git a/crates/io/or-io/src/gta6/script/passes/structure_tails.rs b/crates/io/or-io/src/gta6/script/passes/structure/tails/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/structure_tails.rs rename to crates/io/or-io/src/gta6/script/passes/structure/tails/mod.rs index 536162aba..1f2b130af 100644 --- a/crates/io/or-io/src/gta6/script/passes/structure_tails.rs +++ b/crates/io/or-io/src/gta6/script/passes/structure/tails/mod.rs @@ -578,5 +578,4 @@ fn dropped_labels(body: &mut Vec, named: &HashMap) -> bool { } #[cfg(test)] -#[path = "structure_tails_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/structure_tails_tests.rs b/crates/io/or-io/src/gta6/script/passes/structure/tails/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/structure_tails_tests.rs rename to crates/io/or-io/src/gta6/script/passes/structure/tails/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/structure_tests.rs b/crates/io/or-io/src/gta6/script/passes/structure/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/structure_tests.rs rename to crates/io/or-io/src/gta6/script/passes/structure/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_boxes.rs b/crates/io/or-io/src/gta6/script/passes/sugar_expressions/boxes/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/sugar_boxes.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_expressions/boxes/mod.rs index 71b0706d4..0679b42a7 100644 --- a/crates/io/or-io/src/gta6/script/passes/sugar_boxes.rs +++ b/crates/io/or-io/src/gta6/script/passes/sugar_expressions/boxes/mod.rs @@ -383,5 +383,4 @@ fn handed(e: &mut Expr, head: &Head, project: &Project, names: &Names) { } #[cfg(test)] -#[path = "sugar_boxes_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_boxes_tests.rs b/crates/io/or-io/src/gta6/script/passes/sugar_expressions/boxes/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/sugar_boxes_tests.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_expressions/boxes/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_expressions.rs b/crates/io/or-io/src/gta6/script/passes/sugar_expressions/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/sugar_expressions.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_expressions/mod.rs index 090a4d894..624436ef8 100644 --- a/crates/io/or-io/src/gta6/script/passes/sugar_expressions.rs +++ b/crates/io/or-io/src/gta6/script/passes/sugar_expressions/mod.rs @@ -1590,12 +1590,9 @@ fn initialisers(list: &mut Vec, around: &Around<'_>) { *list = out; } -#[path = "sugar_switch.rs"] mod switch; -#[path = "sugar_boxes.rs"] mod boxes; #[cfg(test)] -#[path = "sugar_expressions_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_switch.rs b/crates/io/or-io/src/gta6/script/passes/sugar_expressions/switch/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/sugar_switch.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_expressions/switch/mod.rs index 52adefe2c..bc9c4d8be 100644 --- a/crates/io/or-io/src/gta6/script/passes/sugar_switch.rs +++ b/crates/io/or-io/src/gta6/script/passes/sugar_expressions/switch/mod.rs @@ -912,5 +912,4 @@ pub(super) fn switched(list: &mut Vec, at: usize, whole: bool) { } #[cfg(test)] -#[path = "sugar_switch_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_switch_tests.rs b/crates/io/or-io/src/gta6/script/passes/sugar_expressions/switch/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/sugar_switch_tests.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_expressions/switch/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_expressions_nested_tests.rs b/crates/io/or-io/src/gta6/script/passes/sugar_expressions/tests/inside.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/sugar_expressions_nested_tests.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_expressions/tests/inside.rs diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_expressions_tests.rs b/crates/io/or-io/src/gta6/script/passes/sugar_expressions/tests/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/sugar_expressions_tests.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_expressions/tests/mod.rs index 32d35fbb3..7a2f443ea 100644 --- a/crates/io/or-io/src/gta6/script/passes/sugar_expressions_tests.rs +++ b/crates/io/or-io/src/gta6/script/passes/sugar_expressions/tests/mod.rs @@ -764,5 +764,4 @@ fn a_bitwise_store_through_a_typed_or_four_byte_unknown_field_reads_as_compound( assert!(compound(&s_int_var, &head, &project, Some(owner)).is_none()); } -#[path = "sugar_expressions_nested_tests.rs"] mod inside; diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_runtime.rs b/crates/io/or-io/src/gta6/script/passes/sugar_runtime/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/sugar_runtime.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_runtime/mod.rs index d0e63efde..b8491a751 100644 --- a/crates/io/or-io/src/gta6/script/passes/sugar_runtime.rs +++ b/crates/io/or-io/src/gta6/script/passes/sugar_runtime/mod.rs @@ -14,7 +14,6 @@ use crate::gta6::script::{Context, Pass, Stats}; use super::sugar_expressions::Reached; -#[path = "sugar_runtime_table.rs"] mod table; use table::Reading; @@ -427,5 +426,4 @@ fn mentions(e: &Expr, var: Var) -> bool { } #[cfg(test)] -#[path = "sugar_runtime_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_runtime_table.rs b/crates/io/or-io/src/gta6/script/passes/sugar_runtime/table.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/sugar_runtime_table.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_runtime/table.rs diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_runtime_tests.rs b/crates/io/or-io/src/gta6/script/passes/sugar_runtime/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/sugar_runtime_tests.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_runtime/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_statements_enumerators.rs b/crates/io/or-io/src/gta6/script/passes/sugar_statements/enumerators/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/sugar_statements_enumerators.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_statements/enumerators/mod.rs index 79a886182..981d850da 100644 --- a/crates/io/or-io/src/gta6/script/passes/sugar_statements_enumerators.rs +++ b/crates/io/or-io/src/gta6/script/passes/sugar_statements/enumerators/mod.rs @@ -437,5 +437,4 @@ pub fn enumerated<'a>(setup: &'a [ir::Stmt], cond: &Expr) -> Option<(&'a [ir::St } #[cfg(test)] -#[path = "sugar_statements_enumerators_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_statements_enumerators_tests.rs b/crates/io/or-io/src/gta6/script/passes/sugar_statements/enumerators/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/sugar_statements_enumerators_tests.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_statements/enumerators/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_statements_guards.rs b/crates/io/or-io/src/gta6/script/passes/sugar_statements/guards/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/sugar_statements_guards.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_statements/guards/mod.rs index 9ee7caa45..7fe8284ca 100644 --- a/crates/io/or-io/src/gta6/script/passes/sugar_statements_guards.rs +++ b/crates/io/or-io/src/gta6/script/passes/sugar_statements/guards/mod.rs @@ -553,5 +553,4 @@ pub fn protected(f: cfg::Function, regions: &[cfg::Region], cx: &Context<'_>) -> } #[cfg(test)] -#[path = "sugar_statements_guards_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_statements_guards_tests.rs b/crates/io/or-io/src/gta6/script/passes/sugar_statements/guards/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/sugar_statements_guards_tests.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_statements/guards/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_statements_lists.rs b/crates/io/or-io/src/gta6/script/passes/sugar_statements/lists/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/sugar_statements_lists.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_statements/lists/mod.rs index 5dc750c4f..3979b7eb7 100644 --- a/crates/io/or-io/src/gta6/script/passes/sugar_statements_lists.rs +++ b/crates/io/or-io/src/gta6/script/passes/sugar_statements/lists/mod.rs @@ -739,5 +739,4 @@ fn simples(stmts: &[Stmt]) -> Option> { } #[cfg(test)] -#[path = "sugar_statements_lists_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_statements_lists_tests.rs b/crates/io/or-io/src/gta6/script/passes/sugar_statements/lists/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/sugar_statements_lists_tests.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_statements/lists/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_statements.rs b/crates/io/or-io/src/gta6/script/passes/sugar_statements/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/sugar_statements.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_statements/mod.rs index 804143095..d2370957e 100644 --- a/crates/io/or-io/src/gta6/script/passes/sugar_statements.rs +++ b/crates/io/or-io/src/gta6/script/passes/sugar_statements/mod.rs @@ -20,13 +20,10 @@ use crate::gta6::script::ir::{ use crate::gta6::script::tree::{self, Stmt, Sugar}; use crate::gta6::script::{Context, Pass, Stats}; -#[path = "sugar_statements_guards.rs"] mod guards; -#[path = "sugar_statements_enumerators.rs"] mod enumerators; -#[path = "sugar_statements_lists.rs"] mod lists; pub use enumerators::enumerated; @@ -1692,5 +1689,4 @@ fn enumerator_foreach( } #[cfg(test)] -#[path = "sugar_statements_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/sugar_statements_tests.rs b/crates/io/or-io/src/gta6/script/passes/sugar_statements/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/sugar_statements_tests.rs rename to crates/io/or-io/src/gta6/script/passes/sugar_statements/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/types_kinds.rs b/crates/io/or-io/src/gta6/script/passes/types/kinds.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/types_kinds.rs rename to crates/io/or-io/src/gta6/script/passes/types/kinds.rs diff --git a/crates/io/or-io/src/gta6/script/passes/types.rs b/crates/io/or-io/src/gta6/script/passes/types/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/types.rs rename to crates/io/or-io/src/gta6/script/passes/types/mod.rs index c797a00db..734b9690a 100644 --- a/crates/io/or-io/src/gta6/script/passes/types.rs +++ b/crates/io/or-io/src/gta6/script/passes/types/mod.rs @@ -17,9 +17,7 @@ use crate::gta6::script::names::Names; use crate::gta6::script::project::{signatures, Signature}; use crate::gta6::script::{Context, Pass, Project, Stats}; -#[path = "types_kinds.rs"] mod kinds; -#[path = "types_objects.rs"] mod objects; use kinds::Lat; @@ -3430,5 +3428,4 @@ fn handles(cfg: &cfg::Cfg, wide: &HashSet) -> HashSet { } #[cfg(test)] -#[path = "types_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/types_objects.rs b/crates/io/or-io/src/gta6/script/passes/types/objects/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/types_objects.rs rename to crates/io/or-io/src/gta6/script/passes/types/objects/mod.rs index a0acc76cc..023128534 100644 --- a/crates/io/or-io/src/gta6/script/passes/types_objects.rs +++ b/crates/io/or-io/src/gta6/script/passes/types/objects/mod.rs @@ -480,5 +480,4 @@ impl Typing<'_> { } #[cfg(test)] -#[path = "types_objects_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/types_objects_tests.rs b/crates/io/or-io/src/gta6/script/passes/types/objects/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/types_objects_tests.rs rename to crates/io/or-io/src/gta6/script/passes/types/objects/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/types_tests.rs b/crates/io/or-io/src/gta6/script/passes/types/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/types_tests.rs rename to crates/io/or-io/src/gta6/script/passes/types/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/values_cells.rs b/crates/io/or-io/src/gta6/script/passes/values/cells.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/values_cells.rs rename to crates/io/or-io/src/gta6/script/passes/values/cells.rs diff --git a/crates/io/or-io/src/gta6/script/passes/values_effects.rs b/crates/io/or-io/src/gta6/script/passes/values/effects.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/values_effects.rs rename to crates/io/or-io/src/gta6/script/passes/values/effects.rs diff --git a/crates/io/or-io/src/gta6/script/passes/values_fold_across.rs b/crates/io/or-io/src/gta6/script/passes/values/fold/across/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/values_fold_across.rs rename to crates/io/or-io/src/gta6/script/passes/values/fold/across/mod.rs index 530430add..e5753a8cd 100644 --- a/crates/io/or-io/src/gta6/script/passes/values_fold_across.rs +++ b/crates/io/or-io/src/gta6/script/passes/values/fold/across/mod.rs @@ -261,5 +261,4 @@ pub(in crate::gta6::script::passes) fn across(f: &mut cfg::Function, finer: bool } #[cfg(test)] -#[path = "values_fold_across_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/values_fold_across_tests.rs b/crates/io/or-io/src/gta6/script/passes/values/fold/across/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/values_fold_across_tests.rs rename to crates/io/or-io/src/gta6/script/passes/values/fold/across/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/values_fold_chain.rs b/crates/io/or-io/src/gta6/script/passes/values/fold/chain/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/values_fold_chain.rs rename to crates/io/or-io/src/gta6/script/passes/values/fold/chain/mod.rs index c76b0978c..e38ede4d0 100644 --- a/crates/io/or-io/src/gta6/script/passes/values_fold_chain.rs +++ b/crates/io/or-io/src/gta6/script/passes/values/fold/chain/mod.rs @@ -213,5 +213,4 @@ pub(in crate::gta6::script::passes) fn chained(f: &mut cfg::Function) -> bool { } #[cfg(test)] -#[path = "values_fold_chain_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/values_fold_chain_tests.rs b/crates/io/or-io/src/gta6/script/passes/values/fold/chain/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/values_fold_chain_tests.rs rename to crates/io/or-io/src/gta6/script/passes/values/fold/chain/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/values_fold.rs b/crates/io/or-io/src/gta6/script/passes/values/fold/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/values_fold.rs rename to crates/io/or-io/src/gta6/script/passes/values/fold/mod.rs index 692c7c48f..c90ac6582 100644 --- a/crates/io/or-io/src/gta6/script/passes/values_fold.rs +++ b/crates/io/or-io/src/gta6/script/passes/values/fold/mod.rs @@ -9,13 +9,10 @@ use crate::gta6::script::ir::{ use super::effects::{cells_of, depth, evaluated, inert, one_cell, stored, Effects, Facts}; -#[path = "values_fold_across.rs"] mod across; pub(in crate::gta6::script::passes) use self::across::across; -#[path = "values_fold_chain.rs"] mod chain; pub(in crate::gta6::script::passes) use self::chain::chained; -#[path = "values_fold_made.rs"] mod objects; use self::objects::Made; @@ -1562,5 +1559,4 @@ pub(super) fn steps(f: &mut cfg::Function) { } #[cfg(test)] -#[path = "values_fold_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/values_fold_made.rs b/crates/io/or-io/src/gta6/script/passes/values/fold/objects/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/values_fold_made.rs rename to crates/io/or-io/src/gta6/script/passes/values/fold/objects/mod.rs index 9fa6e5164..f5ab5ded7 100644 --- a/crates/io/or-io/src/gta6/script/passes/values_fold_made.rs +++ b/crates/io/or-io/src/gta6/script/passes/values/fold/objects/mod.rs @@ -199,5 +199,4 @@ impl Made { } #[cfg(test)] -#[path = "values_fold_made_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/values_fold_made_tests.rs b/crates/io/or-io/src/gta6/script/passes/values/fold/objects/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/values_fold_made_tests.rs rename to crates/io/or-io/src/gta6/script/passes/values/fold/objects/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/values_fold_tests.rs b/crates/io/or-io/src/gta6/script/passes/values/fold/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/values_fold_tests.rs rename to crates/io/or-io/src/gta6/script/passes/values/fold/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/values_joins.rs b/crates/io/or-io/src/gta6/script/passes/values/joins.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/values_joins.rs rename to crates/io/or-io/src/gta6/script/passes/values/joins.rs diff --git a/crates/io/or-io/src/gta6/script/passes/values_locals.rs b/crates/io/or-io/src/gta6/script/passes/values/locals/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/values_locals.rs rename to crates/io/or-io/src/gta6/script/passes/values/locals/mod.rs index ed48b2509..2f4ae0a0d 100644 --- a/crates/io/or-io/src/gta6/script/passes/values_locals.rs +++ b/crates/io/or-io/src/gta6/script/passes/values/locals/mod.rs @@ -336,5 +336,4 @@ fn unique(word: &str, taken: &mut BTreeSet) -> String { } #[cfg(test)] -#[path = "values_locals_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/values_locals_tests.rs b/crates/io/or-io/src/gta6/script/passes/values/locals/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/values_locals_tests.rs rename to crates/io/or-io/src/gta6/script/passes/values/locals/tests.rs diff --git a/crates/io/or-io/src/gta6/script/passes/values.rs b/crates/io/or-io/src/gta6/script/passes/values/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/passes/values.rs rename to crates/io/or-io/src/gta6/script/passes/values/mod.rs index 57bc440e4..f1abc0447 100644 --- a/crates/io/or-io/src/gta6/script/passes/values.rs +++ b/crates/io/or-io/src/gta6/script/passes/values/mod.rs @@ -4,15 +4,10 @@ //! computes and the order of its calls, stores and loads can be shown to stay; a temporary no //! rewrite is sure of stays a variable. -#[path = "values_cells.rs"] mod cells; -#[path = "values_effects.rs"] pub(super) mod effects; -#[path = "values_fold.rs"] pub(super) mod fold; -#[path = "values_joins.rs"] mod joins; -#[path = "values_locals.rs"] pub(crate) mod locals; use std::collections::BTreeSet; @@ -600,5 +595,4 @@ fn proved(f: &mut cfg::Function) -> bool { } #[cfg(test)] -#[path = "values_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/passes/values_tests.rs b/crates/io/or-io/src/gta6/script/passes/values/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/passes/values_tests.rs rename to crates/io/or-io/src/gta6/script/passes/values/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print_bare.rs b/crates/io/or-io/src/gta6/script/print/bare/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print_bare.rs rename to crates/io/or-io/src/gta6/script/print/bare/mod.rs index 2a5adbee3..ade55b71b 100644 --- a/crates/io/or-io/src/gta6/script/print_bare.rs +++ b/crates/io/or-io/src/gta6/script/print/bare/mod.rs @@ -235,5 +235,4 @@ pub(super) fn statics(text: &str) -> BTreeSet { } #[cfg(test)] -#[path = "print_bare_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_bare_tests.rs b/crates/io/or-io/src/gta6/script/print/bare/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_bare_tests.rs rename to crates/io/or-io/src/gta6/script/print/bare/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print_sugar.rs b/crates/io/or-io/src/gta6/script/print/constructs/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print_sugar.rs rename to crates/io/or-io/src/gta6/script/print/constructs/mod.rs index 7a7d194b5..263b43504 100644 --- a/crates/io/or-io/src/gta6/script/print_sugar.rs +++ b/crates/io/or-io/src/gta6/script/print/constructs/mod.rs @@ -1581,5 +1581,4 @@ impl Writer<'_> { } #[cfg(test)] -#[path = "print_sugar_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_sugar_tests.rs b/crates/io/or-io/src/gta6/script/print/constructs/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_sugar_tests.rs rename to crates/io/or-io/src/gta6/script/print/constructs/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print_csharp.rs b/crates/io/or-io/src/gta6/script/print/csharp/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print_csharp.rs rename to crates/io/or-io/src/gta6/script/print/csharp/mod.rs index a89a24016..37a9cbe48 100644 --- a/crates/io/or-io/src/gta6/script/print_csharp.rs +++ b/crates/io/or-io/src/gta6/script/print/csharp/mod.rs @@ -764,5 +764,4 @@ impl Writer<'_> { } #[cfg(test)] -#[path = "print_csharp_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_csharp_tests.rs b/crates/io/or-io/src/gta6/script/print/csharp/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_csharp_tests.rs rename to crates/io/or-io/src/gta6/script/print/csharp/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print_enums.rs b/crates/io/or-io/src/gta6/script/print/enums/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print_enums.rs rename to crates/io/or-io/src/gta6/script/print/enums/mod.rs index c4a96e18a..f2c1f0024 100644 --- a/crates/io/or-io/src/gta6/script/print_enums.rs +++ b/crates/io/or-io/src/gta6/script/print/enums/mod.rs @@ -487,5 +487,4 @@ impl Writer<'_> { } #[cfg(test)] -#[path = "print_enums_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_enums_tests.rs b/crates/io/or-io/src/gta6/script/print/enums/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_enums_tests.rs rename to crates/io/or-io/src/gta6/script/print/enums/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print_inlined.rs b/crates/io/or-io/src/gta6/script/print/inlined.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_inlined.rs rename to crates/io/or-io/src/gta6/script/print/inlined.rs diff --git a/crates/io/or-io/src/gta6/script/print_async.rs b/crates/io/or-io/src/gta6/script/print/iterators.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_async.rs rename to crates/io/or-io/src/gta6/script/print/iterators.rs diff --git a/crates/io/or-io/src/gta6/script/print_lambda_jumps.rs b/crates/io/or-io/src/gta6/script/print/lambda/jumps.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_lambda_jumps.rs rename to crates/io/or-io/src/gta6/script/print/lambda/jumps.rs diff --git a/crates/io/or-io/src/gta6/script/print_lambda.rs b/crates/io/or-io/src/gta6/script/print/lambda/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print_lambda.rs rename to crates/io/or-io/src/gta6/script/print/lambda/mod.rs index 0304270bb..604e0e3b0 100644 --- a/crates/io/or-io/src/gta6/script/print_lambda.rs +++ b/crates/io/or-io/src/gta6/script/print/lambda/mod.rs @@ -2,11 +2,8 @@ //! of one function that writes them there; the closure classes written nowhere once every lambda //! of theirs is; and the method group a delegate of no lambda reads as. -#[path = "print_lambda_jumps.rs"] mod jumps; -#[path = "print_lambda_through.rs"] mod through; -#[path = "print_lambda_widths.rs"] mod widths; use widths::Shape; @@ -3162,5 +3159,4 @@ impl Writer<'_> { } #[cfg(test)] -#[path = "print_lambda_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_lambda_tests.rs b/crates/io/or-io/src/gta6/script/print/lambda/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_lambda_tests.rs rename to crates/io/or-io/src/gta6/script/print/lambda/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print_lambda_through.rs b/crates/io/or-io/src/gta6/script/print/lambda/through.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_lambda_through.rs rename to crates/io/or-io/src/gta6/script/print/lambda/through.rs diff --git a/crates/io/or-io/src/gta6/script/print_lambda_widths.rs b/crates/io/or-io/src/gta6/script/print/lambda/widths.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_lambda_widths.rs rename to crates/io/or-io/src/gta6/script/print/lambda/widths.rs diff --git a/crates/io/or-io/src/gta6/script/print_lay.rs b/crates/io/or-io/src/gta6/script/print/lay/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print_lay.rs rename to crates/io/or-io/src/gta6/script/print/lay/mod.rs index e3115f4ba..73ccd1ac5 100644 --- a/crates/io/or-io/src/gta6/script/print_lay.rs +++ b/crates/io/or-io/src/gta6/script/print/lay/mod.rs @@ -300,5 +300,4 @@ fn cut(text: &str) -> Option<(Place, Vec<&str>)> { } #[cfg(test)] -#[path = "print_lay_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_lay_tests.rs b/crates/io/or-io/src/gta6/script/print/lay/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_lay_tests.rs rename to crates/io/or-io/src/gta6/script/print/lay/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print_legend.rs b/crates/io/or-io/src/gta6/script/print/legend.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_legend.rs rename to crates/io/or-io/src/gta6/script/print/legend.rs diff --git a/crates/io/or-io/src/gta6/script/print_member.rs b/crates/io/or-io/src/gta6/script/print/members/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print_member.rs rename to crates/io/or-io/src/gta6/script/print/members/mod.rs index 4a077d3d5..aeb4e3b32 100644 --- a/crates/io/or-io/src/gta6/script/print_member.rs +++ b/crates/io/or-io/src/gta6/script/print/members/mod.rs @@ -241,5 +241,4 @@ impl Writer<'_> { } #[cfg(test)] -#[path = "print_member_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_member_tests.rs b/crates/io/or-io/src/gta6/script/print/members/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_member_tests.rs rename to crates/io/or-io/src/gta6/script/print/members/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print.rs b/crates/io/or-io/src/gta6/script/print/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print.rs rename to crates/io/or-io/src/gta6/script/print/mod.rs index 173bdda15..c0370ca9d 100644 --- a/crates/io/or-io/src/gta6/script/print.rs +++ b/crates/io/or-io/src/gta6/script/print/mod.rs @@ -17,39 +17,24 @@ //! float, never a conversion. A conversion is a call, `i32_to_f32(x)`. True C# writes //! `as_f32(x)` for the first, so that a cast there always converts. -#[path = "print_bare.rs"] mod bare; -#[path = "print_sugar.rs"] mod constructs; -#[path = "print_csharp.rs"] mod csharp; -#[path = "print_enums.rs"] pub(super) mod enums; -#[path = "print_inlined.rs"] mod inlined; -#[path = "print_async.rs"] mod iterators; -#[path = "print_lambda.rs"] mod lambda; -#[path = "print_lay.rs"] mod lay; -#[path = "print_legend.rs"] mod legend; -#[path = "print_member.rs"] mod members; -#[path = "print_natives.rs"] mod natives; pub(super) use natives::axis; -#[path = "print_old.rs"] mod old; -#[path = "print_property.rs"] mod property; #[cfg(test)] pub(super) use property::declared_accessors; pub(super) use property::{indexer, indexer_part, IndexerPart}; -#[path = "print_prelude.rs"] pub mod prelude; -#[path = "print_spell.rs"] mod spell; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; @@ -6312,5 +6297,4 @@ fn readable_const(c: &Const) -> String { } #[cfg(test)] -#[path = "print_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_natives.rs b/crates/io/or-io/src/gta6/script/print/natives/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print_natives.rs rename to crates/io/or-io/src/gta6/script/print/natives/mod.rs index f3c6f5626..473294f53 100644 --- a/crates/io/or-io/src/gta6/script/print_natives.rs +++ b/crates/io/or-io/src/gta6/script/print/natives/mod.rs @@ -305,5 +305,4 @@ impl Writer<'_> { } #[cfg(test)] -#[path = "print_natives_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_natives_tests.rs b/crates/io/or-io/src/gta6/script/print/natives/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_natives_tests.rs rename to crates/io/or-io/src/gta6/script/print/natives/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print_old.rs b/crates/io/or-io/src/gta6/script/print/old.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_old.rs rename to crates/io/or-io/src/gta6/script/print/old.rs diff --git a/crates/io/or-io/src/gta6/script/print_prelude.rs b/crates/io/or-io/src/gta6/script/print/prelude/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print_prelude.rs rename to crates/io/or-io/src/gta6/script/print/prelude/mod.rs index 71663ac01..0ced5b71e 100644 --- a/crates/io/or-io/src/gta6/script/print_prelude.rs +++ b/crates/io/or-io/src/gta6/script/print/prelude/mod.rs @@ -1262,5 +1262,4 @@ fn natives(out: &mut String, names: &Names, used: &Used) { } #[cfg(test)] -#[path = "print_prelude_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_prelude_tests.rs b/crates/io/or-io/src/gta6/script/print/prelude/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_prelude_tests.rs rename to crates/io/or-io/src/gta6/script/print/prelude/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print_property.rs b/crates/io/or-io/src/gta6/script/print/property/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print_property.rs rename to crates/io/or-io/src/gta6/script/print/property/mod.rs index 9cc9f5cf6..03f12e13d 100644 --- a/crates/io/or-io/src/gta6/script/print_property.rs +++ b/crates/io/or-io/src/gta6/script/print/property/mod.rs @@ -206,5 +206,4 @@ pub(crate) fn declared_accessors<'m>( } #[cfg(test)] -#[path = "print_property_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_property_tests.rs b/crates/io/or-io/src/gta6/script/print/property/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_property_tests.rs rename to crates/io/or-io/src/gta6/script/print/property/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print_spell.rs b/crates/io/or-io/src/gta6/script/print/spell/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/print_spell.rs rename to crates/io/or-io/src/gta6/script/print/spell/mod.rs index edfc1818e..c1102b5c6 100644 --- a/crates/io/or-io/src/gta6/script/print_spell.rs +++ b/crates/io/or-io/src/gta6/script/print/spell/mod.rs @@ -881,5 +881,4 @@ impl Writer<'_> { } #[cfg(test)] -#[path = "print_spell_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/print_spell_tests.rs b/crates/io/or-io/src/gta6/script/print/spell/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_spell_tests.rs rename to crates/io/or-io/src/gta6/script/print/spell/tests.rs diff --git a/crates/io/or-io/src/gta6/script/print_tests.rs b/crates/io/or-io/src/gta6/script/print/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/print_tests.rs rename to crates/io/or-io/src/gta6/script/print/tests.rs diff --git a/crates/io/or-io/src/gta6/script/program_functions.rs b/crates/io/or-io/src/gta6/script/program/functions.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/program_functions.rs rename to crates/io/or-io/src/gta6/script/program/functions.rs diff --git a/crates/io/or-io/src/gta6/script/program.rs b/crates/io/or-io/src/gta6/script/program/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/program.rs rename to crates/io/or-io/src/gta6/script/program/mod.rs index 0127cf5bd..0ff83f3ea 100644 --- a/crates/io/or-io/src/gta6/script/program.rs +++ b/crates/io/or-io/src/gta6/script/program/mod.rs @@ -4,9 +4,7 @@ //! and no table is sized from a number the file states before that number is held against the //! file's own length. -#[path = "program_functions.rs"] mod functions; -#[path = "program_read.rs"] mod read; use std::collections::BTreeMap; @@ -349,5 +347,4 @@ impl Program { } #[cfg(test)] -#[path = "program_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/program_read.rs b/crates/io/or-io/src/gta6/script/program/read.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/program_read.rs rename to crates/io/or-io/src/gta6/script/program/read.rs diff --git a/crates/io/or-io/src/gta6/script/program_tests.rs b/crates/io/or-io/src/gta6/script/program/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/program_tests.rs rename to crates/io/or-io/src/gta6/script/program/tests.rs diff --git a/crates/io/or-io/src/gta6/script/project/index.rs b/crates/io/or-io/src/gta6/script/project/index/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/project/index.rs rename to crates/io/or-io/src/gta6/script/project/index/mod.rs index 7e1b9c078..523fac24c 100644 --- a/crates/io/or-io/src/gta6/script/project/index.rs +++ b/crates/io/or-io/src/gta6/script/project/index/mod.rs @@ -1217,5 +1217,4 @@ pub fn load(bytes: &[u8]) -> Result { } #[cfg(test)] -#[path = "index_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/project/index_tests.rs b/crates/io/or-io/src/gta6/script/project/index/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/index_tests.rs rename to crates/io/or-io/src/gta6/script/project/index/tests.rs diff --git a/crates/io/or-io/src/gta6/script/project/layouts_flows.rs b/crates/io/or-io/src/gta6/script/project/layouts/flows.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/layouts_flows.rs rename to crates/io/or-io/src/gta6/script/project/layouts/flows.rs diff --git a/crates/io/or-io/src/gta6/script/project/layouts.rs b/crates/io/or-io/src/gta6/script/project/layouts/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/project/layouts.rs rename to crates/io/or-io/src/gta6/script/project/layouts/mod.rs index fc60f9325..b011b3523 100644 --- a/crates/io/or-io/src/gta6/script/project/layouts.rs +++ b/crates/io/or-io/src/gta6/script/project/layouts/mod.rs @@ -30,7 +30,6 @@ use crate::gta6::script::print::cells_of; use crate::gta6::script::program::{FunctionRow, Program, TypeRow}; use crate::gta6::script::{cfg, decode, lift}; -#[path = "layouts_flows.rs"] mod flows; pub use flows::{Does, Flow, Origin}; @@ -4209,5 +4208,4 @@ fn past( } #[cfg(test)] -#[path = "layouts_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/project/layouts_tests.rs b/crates/io/or-io/src/gta6/script/project/layouts/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/layouts_tests.rs rename to crates/io/or-io/src/gta6/script/project/layouts/tests.rs diff --git a/crates/io/or-io/src/gta6/script/project/mod.rs b/crates/io/or-io/src/gta6/script/project/mod.rs index d11cb1bab..ea606bb35 100644 --- a/crates/io/or-io/src/gta6/script/project/mod.rs +++ b/crates/io/or-io/src/gta6/script/project/mod.rs @@ -489,5 +489,4 @@ impl Project { } #[cfg(test)] -#[path = "project_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/project/outside_async.rs b/crates/io/or-io/src/gta6/script/project/outside/asyncs.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/outside_async.rs rename to crates/io/or-io/src/gta6/script/project/outside/asyncs.rs diff --git a/crates/io/or-io/src/gta6/script/project/outside.rs b/crates/io/or-io/src/gta6/script/project/outside/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/project/outside.rs rename to crates/io/or-io/src/gta6/script/project/outside/mod.rs index 8432a8419..aef09d577 100644 --- a/crates/io/or-io/src/gta6/script/project/outside.rs +++ b/crates/io/or-io/src/gta6/script/project/outside/mod.rs @@ -18,7 +18,6 @@ use crate::gta6::script::ir::{ use crate::gta6::script::opcode::Op; use crate::gta6::script::program::{FunctionRow, Program, SlotRow, TypeRow}; -#[path = "outside_async.rs"] mod asyncs; pub use asyncs::{AsyncMethod, Asyncs}; @@ -844,5 +843,4 @@ fn closed_over(project: &Project, unnamed: Vec<(TypeKey, u32)>) -> Vec<(TypeKey, } #[cfg(test)] -#[path = "outside_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/project/outside_tests.rs b/crates/io/or-io/src/gta6/script/project/outside/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/outside_tests.rs rename to crates/io/or-io/src/gta6/script/project/outside/tests.rs diff --git a/crates/io/or-io/src/gta6/script/project/reach.rs b/crates/io/or-io/src/gta6/script/project/reach/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/project/reach.rs rename to crates/io/or-io/src/gta6/script/project/reach/mod.rs index ca37953de..c83408b40 100644 --- a/crates/io/or-io/src/gta6/script/project/reach.rs +++ b/crates/io/or-io/src/gta6/script/project/reach/mod.rs @@ -1078,5 +1078,4 @@ impl Project { } #[cfg(test)] -#[path = "reach_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/project/reach_tests.rs b/crates/io/or-io/src/gta6/script/project/reach/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/reach_tests.rs rename to crates/io/or-io/src/gta6/script/project/reach/tests.rs diff --git a/crates/io/or-io/src/gta6/script/project/signatures_arguments.rs b/crates/io/or-io/src/gta6/script/project/signatures/arguments/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/project/signatures_arguments.rs rename to crates/io/or-io/src/gta6/script/project/signatures/arguments/mod.rs index bf3d97bff..c515c60bb 100644 --- a/crates/io/or-io/src/gta6/script/project/signatures_arguments.rs +++ b/crates/io/or-io/src/gta6/script/project/signatures/arguments/mod.rs @@ -2959,7 +2959,6 @@ fn fill_slot_widths(project: &mut Project) { } #[cfg(test)] -#[path = "signatures_arguments_tests.rs"] mod tests; /// Why each cell and each result the calls and the returns may type is typed or not, counted: for reading a run over a corpus. diff --git a/crates/io/or-io/src/gta6/script/project/signatures_arguments_tests.rs b/crates/io/or-io/src/gta6/script/project/signatures/arguments/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/signatures_arguments_tests.rs rename to crates/io/or-io/src/gta6/script/project/signatures/arguments/tests.rs diff --git a/crates/io/or-io/src/gta6/script/project/signatures.rs b/crates/io/or-io/src/gta6/script/project/signatures/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/project/signatures.rs rename to crates/io/or-io/src/gta6/script/project/signatures/mod.rs index 24e7245c0..838ed18b9 100644 --- a/crates/io/or-io/src/gta6/script/project/signatures.rs +++ b/crates/io/or-io/src/gta6/script/project/signatures/mod.rs @@ -31,11 +31,8 @@ use crate::gta6::script::print::cells_of; use crate::gta6::script::program::Program; use crate::gta6::script::{Names, Options, Pass}; -#[path = "signatures_arguments.rs"] mod arguments; -#[path = "signatures_shared.rs"] mod shared; -#[path = "signatures_sites.rs"] mod sites; #[cfg(test)] @@ -1671,5 +1668,4 @@ fn parameters(project: &mut Project, open: &BTreeMap) { } #[cfg(test)] -#[path = "signatures_tests.rs"] pub(crate) mod tests; diff --git a/crates/io/or-io/src/gta6/script/project/signatures_shared.rs b/crates/io/or-io/src/gta6/script/project/signatures/shared.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/signatures_shared.rs rename to crates/io/or-io/src/gta6/script/project/signatures/shared.rs diff --git a/crates/io/or-io/src/gta6/script/project/signatures_sites.rs b/crates/io/or-io/src/gta6/script/project/signatures/sites.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/signatures_sites.rs rename to crates/io/or-io/src/gta6/script/project/signatures/sites.rs diff --git a/crates/io/or-io/src/gta6/script/project/signatures_tests.rs b/crates/io/or-io/src/gta6/script/project/signatures/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/signatures_tests.rs rename to crates/io/or-io/src/gta6/script/project/signatures/tests.rs diff --git a/crates/io/or-io/src/gta6/script/project/project_tests.rs b/crates/io/or-io/src/gta6/script/project/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/project_tests.rs rename to crates/io/or-io/src/gta6/script/project/tests.rs diff --git a/crates/io/or-io/src/gta6/script/project/types.rs b/crates/io/or-io/src/gta6/script/project/types/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/project/types.rs rename to crates/io/or-io/src/gta6/script/project/types/mod.rs index 23942bdf5..95375adb8 100644 --- a/crates/io/or-io/src/gta6/script/project/types.rs +++ b/crates/io/or-io/src/gta6/script/project/types/mod.rs @@ -725,5 +725,4 @@ fn unmarked(name: &str, args: usize) -> &str { } #[cfg(test)] -#[path = "types_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/project/types_tests.rs b/crates/io/or-io/src/gta6/script/project/types/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/project/types_tests.rs rename to crates/io/or-io/src/gta6/script/project/types/tests.rs diff --git a/crates/io/or-io/src/gta6/script/reparse_bare.rs b/crates/io/or-io/src/gta6/script/reparse/bare.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/reparse_bare.rs rename to crates/io/or-io/src/gta6/script/reparse/bare.rs diff --git a/crates/io/or-io/src/gta6/script/reparse_enums.rs b/crates/io/or-io/src/gta6/script/reparse/enums.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/reparse_enums.rs rename to crates/io/or-io/src/gta6/script/reparse/enums.rs diff --git a/crates/io/or-io/src/gta6/script/reparse_file.rs b/crates/io/or-io/src/gta6/script/reparse/file/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/reparse_file.rs rename to crates/io/or-io/src/gta6/script/reparse/file/mod.rs index e3f2278d1..1879a36e1 100644 --- a/crates/io/or-io/src/gta6/script/reparse_file.rs +++ b/crates/io/or-io/src/gta6/script/reparse/file/mod.rs @@ -303,5 +303,4 @@ pub fn agrees_file( } #[cfg(test)] -#[path = "reparse_file_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/reparse_file_tests.rs b/crates/io/or-io/src/gta6/script/reparse/file/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/reparse_file_tests.rs rename to crates/io/or-io/src/gta6/script/reparse/file/tests.rs diff --git a/crates/io/or-io/src/gta6/script/reparse_inlined.rs b/crates/io/or-io/src/gta6/script/reparse/inlined.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/reparse_inlined.rs rename to crates/io/or-io/src/gta6/script/reparse/inlined.rs diff --git a/crates/io/or-io/src/gta6/script/reparse_members.rs b/crates/io/or-io/src/gta6/script/reparse/members.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/reparse_members.rs rename to crates/io/or-io/src/gta6/script/reparse/members.rs diff --git a/crates/io/or-io/src/gta6/script/reparse.rs b/crates/io/or-io/src/gta6/script/reparse/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/reparse.rs rename to crates/io/or-io/src/gta6/script/reparse/mod.rs index 05e65a692..78494ea85 100644 --- a/crates/io/or-io/src/gta6/script/reparse.rs +++ b/crates/io/or-io/src/gta6/script/reparse/mod.rs @@ -5287,21 +5287,14 @@ impl Held<'_> { } } -#[path = "reparse_bare.rs"] mod bare; -#[path = "reparse_enums.rs"] mod enums; -#[path = "reparse_file.rs"] mod file; -#[path = "reparse_inlined.rs"] mod inlined; -#[path = "reparse_property.rs"] mod property; pub use file::{agrees_file, unfiled, Unfiled}; -#[path = "reparse_members.rs"] mod members; pub use members::agrees_members; #[cfg(test)] -#[path = "reparse_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/reparse_property.rs b/crates/io/or-io/src/gta6/script/reparse/property.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/reparse_property.rs rename to crates/io/or-io/src/gta6/script/reparse/property.rs diff --git a/crates/io/or-io/src/gta6/script/reparse_tests.rs b/crates/io/or-io/src/gta6/script/reparse/tests/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/reparse_tests.rs rename to crates/io/or-io/src/gta6/script/reparse/tests/mod.rs index 509c50193..768c43978 100644 --- a/crates/io/or-io/src/gta6/script/reparse_tests.rs +++ b/crates/io/or-io/src/gta6/script/reparse/tests/mod.rs @@ -667,7 +667,6 @@ fn what_the_source_level_writes_of_a_compound_and_an_await_reads_back() { } } -#[path = "reparse_source_tests.rs"] mod source; /// Whether text written by hand as the source level writes `body`, every pass on, says the same as `body`; a form not read back yet is the error it is. diff --git a/crates/io/or-io/src/gta6/script/reparse_source_tests.rs b/crates/io/or-io/src/gta6/script/reparse/tests/source.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/reparse_source_tests.rs rename to crates/io/or-io/src/gta6/script/reparse/tests/source.rs diff --git a/crates/io/or-io/src/gta6/script/sample_tests.rs b/crates/io/or-io/src/gta6/script/sample.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/sample_tests.rs rename to crates/io/or-io/src/gta6/script/sample.rs diff --git a/crates/io/or-io/src/gta6/script/mod_tests.rs b/crates/io/or-io/src/gta6/script/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/mod_tests.rs rename to crates/io/or-io/src/gta6/script/tests.rs diff --git a/crates/io/or-io/src/gta6/script/tree.rs b/crates/io/or-io/src/gta6/script/tree/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script/tree.rs rename to crates/io/or-io/src/gta6/script/tree/mod.rs index c2b660d45..57b1275b9 100644 --- a/crates/io/or-io/src/gta6/script/tree.rs +++ b/crates/io/or-io/src/gta6/script/tree/mod.rs @@ -1012,5 +1012,4 @@ pub fn temporaries(body: &[Stmt]) -> BTreeSet { } #[cfg(test)] -#[path = "tree_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/script/tree_tests.rs b/crates/io/or-io/src/gta6/script/tree/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/script/tree_tests.rs rename to crates/io/or-io/src/gta6/script/tree/tests.rs diff --git a/crates/io/or-io/src/gta6/script_bodies.rs b/crates/io/or-io/src/gta6/script_bodies/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/script_bodies.rs rename to crates/io/or-io/src/gta6/script_bodies/mod.rs index eca147c35..d76fd6ae4 100644 --- a/crates/io/or-io/src/gta6/script_bodies.rs +++ b/crates/io/or-io/src/gta6/script_bodies/mod.rs @@ -285,5 +285,4 @@ fn check(span: &[u8], start: u64, pieces: Vec) -> Result Option { } #[cfg(test)] -#[path = "terrain_tile_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/terrain_tile_tests.rs b/crates/io/or-io/src/gta6/terrain_tile/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/terrain_tile_tests.rs rename to crates/io/or-io/src/gta6/terrain_tile/tests.rs diff --git a/crates/io/or-io/src/gta6/text_edit.rs b/crates/io/or-io/src/gta6/text/edit/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/text_edit.rs rename to crates/io/or-io/src/gta6/text/edit/mod.rs index 69e9710cb..646fa8477 100644 --- a/crates/io/or-io/src/gta6/text_edit.rs +++ b/crates/io/or-io/src/gta6/text/edit/mod.rs @@ -260,5 +260,4 @@ fn base_of(c: char) -> Option<&'static str> { } #[cfg(test)] -#[path = "text_edit_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/text_edit_tests.rs b/crates/io/or-io/src/gta6/text/edit/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/text_edit_tests.rs rename to crates/io/or-io/src/gta6/text/edit/tests.rs diff --git a/crates/io/or-io/src/gta6/text.rs b/crates/io/or-io/src/gta6/text/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/text.rs rename to crates/io/or-io/src/gta6/text/mod.rs index 6922fd4ed..b4c6a3afd 100644 --- a/crates/io/or-io/src/gta6/text.rs +++ b/crates/io/or-io/src/gta6/text/mod.rs @@ -850,7 +850,6 @@ pub struct Rewritten { pub why: String, } -#[path = "text_edit.rs"] mod edit; pub use edit::{fold, key_of, TextQuery}; @@ -1266,5 +1265,4 @@ fn lay_out( } #[cfg(test)] -#[path = "text_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/text_tests.rs b/crates/io/or-io/src/gta6/text/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/text_tests.rs rename to crates/io/or-io/src/gta6/text/tests.rs diff --git a/crates/io/or-io/src/gta6/text_language.rs b/crates/io/or-io/src/gta6/text_language/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/text_language.rs rename to crates/io/or-io/src/gta6/text_language/mod.rs index 8651060a9..b59c41450 100644 --- a/crates/io/or-io/src/gta6/text_language.rs +++ b/crates/io/or-io/src/gta6/text_language/mod.rs @@ -371,5 +371,4 @@ pub fn read_table( } #[cfg(test)] -#[path = "text_language_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/text_language_tests.rs b/crates/io/or-io/src/gta6/text_language/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/text_language_tests.rs rename to crates/io/or-io/src/gta6/text_language/tests.rs diff --git a/crates/io/or-io/src/gta6/timecycle.rs b/crates/io/or-io/src/gta6/timecycle/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/timecycle.rs rename to crates/io/or-io/src/gta6/timecycle/mod.rs index 569cbe0ec..059614350 100644 --- a/crates/io/or-io/src/gta6/timecycle.rs +++ b/crates/io/or-io/src/gta6/timecycle/mod.rs @@ -605,5 +605,4 @@ pub fn height_fog(own: &Keyframe) -> Option { } #[cfg(test)] -#[path = "timecycle_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/timecycle_tests.rs b/crates/io/or-io/src/gta6/timecycle/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/timecycle_tests.rs rename to crates/io/or-io/src/gta6/timecycle/tests.rs diff --git a/crates/io/or-io/src/gta6/ttpf_calibrate.rs b/crates/io/or-io/src/gta6/ttpf/calibrate.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_calibrate.rs rename to crates/io/or-io/src/gta6/ttpf/calibrate.rs diff --git a/crates/io/or-io/src/gta6/ttpf.rs b/crates/io/or-io/src/gta6/ttpf/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/ttpf.rs rename to crates/io/or-io/src/gta6/ttpf/mod.rs index 1c079c701..fc661e211 100644 --- a/crates/io/or-io/src/gta6/ttpf.rs +++ b/crates/io/or-io/src/gta6/ttpf/mod.rs @@ -1555,18 +1555,15 @@ fn is_sparse(metadata: &std::fs::Metadata) -> bool { } } -#[path = "ttpf_calibrate.rs"] mod calibrate; pub use calibrate::{ calibrate_packs, calibrate_packs_from, coverage, keep_checked, probe_packs, score_packs, Calibrated, Coverage, }; -#[path = "ttpf_write.rs"] mod write; pub(super) use write::place; pub use write::{Replaced, SaveLayout, Shape}; #[cfg(test)] -#[path = "ttpf_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/ttpf_author_tests.rs b/crates/io/or-io/src/gta6/ttpf/tests/author.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_author_tests.rs rename to crates/io/or-io/src/gta6/ttpf/tests/author.rs diff --git a/crates/io/or-io/src/gta6/ttpf_calibrate_tests.rs b/crates/io/or-io/src/gta6/ttpf/tests/calibrated.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_calibrate_tests.rs rename to crates/io/or-io/src/gta6/ttpf/tests/calibrated.rs diff --git a/crates/io/or-io/src/gta6/ttpf_bcpack_tests.rs b/crates/io/or-io/src/gta6/ttpf/tests/coder.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_bcpack_tests.rs rename to crates/io/or-io/src/gta6/ttpf/tests/coder.rs diff --git a/crates/io/or-io/src/gta6/ttpf_envelope_tests.rs b/crates/io/or-io/src/gta6/ttpf/tests/envelope.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_envelope_tests.rs rename to crates/io/or-io/src/gta6/ttpf/tests/envelope.rs diff --git a/crates/io/or-io/src/gta6/ttpf_tests.rs b/crates/io/or-io/src/gta6/ttpf/tests/mod.rs similarity index 98% rename from crates/io/or-io/src/gta6/ttpf_tests.rs rename to crates/io/or-io/src/gta6/ttpf/tests/mod.rs index 903148a8c..177dd8602 100644 --- a/crates/io/or-io/src/gta6/ttpf_tests.rs +++ b/crates/io/or-io/src/gta6/ttpf/tests/mod.rs @@ -513,26 +513,18 @@ fn a_sparse_file_of_full_length_is_not_complete() { assert!(!pack.is_complete()); } -#[path = "ttpf_envelope_tests.rs"] mod envelope; -#[path = "ttpf_write_tests.rs"] mod write; -#[path = "ttpf_volume_tests.rs"] mod volumes; -#[path = "ttpf_relayout_tests.rs"] mod relayout; -#[path = "ttpf_slice_tests.rs"] mod slice_replace; -#[path = "ttpf_bcpack_tests.rs"] mod coder; #[cfg(feature = "authoring")] -#[path = "ttpf_author_tests.rs"] mod author; -#[path = "ttpf_calibrate_tests.rs"] mod calibrated; diff --git a/crates/io/or-io/src/gta6/ttpf_relayout_tests.rs b/crates/io/or-io/src/gta6/ttpf/tests/relayout/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/ttpf_relayout_tests.rs rename to crates/io/or-io/src/gta6/ttpf/tests/relayout/mod.rs index 7c676d6ae..c57a3d97d 100644 --- a/crates/io/or-io/src/gta6/ttpf_relayout_tests.rs +++ b/crates/io/or-io/src/gta6/ttpf/tests/relayout/mod.rs @@ -265,7 +265,5 @@ fn each_shape_the_planner_does_not_cover_is_refused_by_name_and_changes_nothing( assert_eq!(Format::of_grc(GrcTextureFormat::A1R5G5B5, false), None); } -#[path = "ttpf_reshape_slices_tests.rs"] mod slices; -#[path = "ttpf_reshape_volume_tests.rs"] mod volume; diff --git a/crates/io/or-io/src/gta6/ttpf_reshape_slices_tests.rs b/crates/io/or-io/src/gta6/ttpf/tests/relayout/slices.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_reshape_slices_tests.rs rename to crates/io/or-io/src/gta6/ttpf/tests/relayout/slices.rs diff --git a/crates/io/or-io/src/gta6/ttpf_reshape_volume_tests.rs b/crates/io/or-io/src/gta6/ttpf/tests/relayout/volume.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_reshape_volume_tests.rs rename to crates/io/or-io/src/gta6/ttpf/tests/relayout/volume.rs diff --git a/crates/io/or-io/src/gta6/ttpf_slice_tests.rs b/crates/io/or-io/src/gta6/ttpf/tests/slice_replace.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_slice_tests.rs rename to crates/io/or-io/src/gta6/ttpf/tests/slice_replace.rs diff --git a/crates/io/or-io/src/gta6/ttpf_volume_tests.rs b/crates/io/or-io/src/gta6/ttpf/tests/volumes.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_volume_tests.rs rename to crates/io/or-io/src/gta6/ttpf/tests/volumes.rs diff --git a/crates/io/or-io/src/gta6/ttpf_write_tests.rs b/crates/io/or-io/src/gta6/ttpf/tests/write.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_write_tests.rs rename to crates/io/or-io/src/gta6/ttpf/tests/write.rs diff --git a/crates/io/or-io/src/gta6/ttpf_write.rs b/crates/io/or-io/src/gta6/ttpf/write/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/ttpf_write.rs rename to crates/io/or-io/src/gta6/ttpf/write/mod.rs index 530809528..dc96d6243 100644 --- a/crates/io/or-io/src/gta6/ttpf_write.rs +++ b/crates/io/or-io/src/gta6/ttpf/write/mod.rs @@ -590,11 +590,8 @@ impl TexturePack { } } -#[path = "ttpf_recode.rs"] mod recode; -#[path = "ttpf_relayout.rs"] mod relayout; -#[path = "ttpf_slice.rs"] mod slice; pub(super) use relayout::Moved; pub use relayout::Shape; diff --git a/crates/io/or-io/src/gta6/ttpf_recode.rs b/crates/io/or-io/src/gta6/ttpf/write/recode.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_recode.rs rename to crates/io/or-io/src/gta6/ttpf/write/recode.rs diff --git a/crates/io/or-io/src/gta6/ttpf_relayout.rs b/crates/io/or-io/src/gta6/ttpf/write/relayout/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/ttpf_relayout.rs rename to crates/io/or-io/src/gta6/ttpf/write/relayout/mod.rs index ee71b4c1b..e41fff0bb 100644 --- a/crates/io/or-io/src/gta6/ttpf_relayout.rs +++ b/crates/io/or-io/src/gta6/ttpf/write/relayout/mod.rs @@ -658,7 +658,5 @@ fn spliced(all: &[T], old: &Range, new: &[T]) -> Vec { [&all[..old.start], new, &all[old.end..]].concat() } -#[path = "ttpf_reshape_slices.rs"] mod slices; -#[path = "ttpf_reshape_volume.rs"] mod volume; diff --git a/crates/io/or-io/src/gta6/ttpf_reshape_slices.rs b/crates/io/or-io/src/gta6/ttpf/write/relayout/slices.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_reshape_slices.rs rename to crates/io/or-io/src/gta6/ttpf/write/relayout/slices.rs diff --git a/crates/io/or-io/src/gta6/ttpf_reshape_volume.rs b/crates/io/or-io/src/gta6/ttpf/write/relayout/volume.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_reshape_volume.rs rename to crates/io/or-io/src/gta6/ttpf/write/relayout/volume.rs diff --git a/crates/io/or-io/src/gta6/ttpf_slice.rs b/crates/io/or-io/src/gta6/ttpf/write/slice.rs similarity index 100% rename from crates/io/or-io/src/gta6/ttpf_slice.rs rename to crates/io/or-io/src/gta6/ttpf/write/slice.rs diff --git a/crates/io/or-io/src/gta6/ui_tree.rs b/crates/io/or-io/src/gta6/ui_tree/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/ui_tree.rs rename to crates/io/or-io/src/gta6/ui_tree/mod.rs index aefa94716..fb12c0e82 100644 --- a/crates/io/or-io/src/gta6/ui_tree.rs +++ b/crates/io/or-io/src/gta6/ui_tree/mod.rs @@ -345,5 +345,4 @@ impl UiTree { } #[cfg(test)] -#[path = "ui_tree_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/ui_tree_tests.rs b/crates/io/or-io/src/gta6/ui_tree/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/ui_tree_tests.rs rename to crates/io/or-io/src/gta6/ui_tree/tests.rs diff --git a/crates/io/or-io/src/gta6/water_fog.rs b/crates/io/or-io/src/gta6/water/fog.rs similarity index 100% rename from crates/io/or-io/src/gta6/water_fog.rs rename to crates/io/or-io/src/gta6/water/fog.rs diff --git a/crates/io/or-io/src/gta6/water_height.rs b/crates/io/or-io/src/gta6/water/height/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/water_height.rs rename to crates/io/or-io/src/gta6/water/height/mod.rs index 877d8dc1b..ff5b4c1b0 100644 --- a/crates/io/or-io/src/gta6/water_height.rs +++ b/crates/io/or-io/src/gta6/water/height/mod.rs @@ -252,5 +252,4 @@ impl WaterGround { } #[cfg(test)] -#[path = "water_height_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/water_height_tests.rs b/crates/io/or-io/src/gta6/water/height/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/water_height_tests.rs rename to crates/io/or-io/src/gta6/water/height/tests.rs diff --git a/crates/io/or-io/src/gta6/water.rs b/crates/io/or-io/src/gta6/water/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/water.rs rename to crates/io/or-io/src/gta6/water/mod.rs index 4d4502ddb..d23567d5c 100644 --- a/crates/io/or-io/src/gta6/water.rs +++ b/crates/io/or-io/src/gta6/water/mod.rs @@ -10,11 +10,8 @@ use crate::meta::binary::pso::table_form; use crate::meta::binary::rbm::schema::RbmModel; use crate::meta::error::MetaError; -#[path = "water_fog.rs"] pub mod fog; -#[path = "water_height.rs"] pub mod height; -#[path = "water_waves.rs"] pub mod waves; pub const WATER_DATA: u32 = lit(b"WaterData"); @@ -366,5 +363,4 @@ impl GridAtlas { } #[cfg(test)] -#[path = "water_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/water_tests.rs b/crates/io/or-io/src/gta6/water/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/water_tests.rs rename to crates/io/or-io/src/gta6/water/tests.rs diff --git a/crates/io/or-io/src/gta6/water_waves.rs b/crates/io/or-io/src/gta6/water/waves.rs similarity index 100% rename from crates/io/or-io/src/gta6/water_waves.rs rename to crates/io/or-io/src/gta6/water/waves.rs diff --git a/crates/io/or-io/src/gta6/weather.rs b/crates/io/or-io/src/gta6/weather/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/weather.rs rename to crates/io/or-io/src/gta6/weather/mod.rs index 4498d40e0..1d1e17924 100644 --- a/crates/io/or-io/src/gta6/weather.rs +++ b/crates/io/or-io/src/gta6/weather/mod.rs @@ -188,5 +188,4 @@ impl WeatherSet { } #[cfg(test)] -#[path = "weather_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/weather_tests.rs b/crates/io/or-io/src/gta6/weather/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/weather_tests.rs rename to crates/io/or-io/src/gta6/weather/tests.rs diff --git a/crates/io/or-io/src/gta6/world_state.rs b/crates/io/or-io/src/gta6/world_state/mod.rs similarity index 99% rename from crates/io/or-io/src/gta6/world_state.rs rename to crates/io/or-io/src/gta6/world_state/mod.rs index 07654eb8f..38945aa88 100644 --- a/crates/io/or-io/src/gta6/world_state.rs +++ b/crates/io/or-io/src/gta6/world_state/mod.rs @@ -710,5 +710,4 @@ fn unread() -> Condition { } #[cfg(test)] -#[path = "world_state_tests.rs"] mod tests; diff --git a/crates/io/or-io/src/gta6/world_state_tests.rs b/crates/io/or-io/src/gta6/world_state/tests.rs similarity index 100% rename from crates/io/or-io/src/gta6/world_state_tests.rs rename to crates/io/or-io/src/gta6/world_state/tests.rs diff --git a/crates/tools/or-cli/src/gta6/hashes.rs b/crates/tools/or-cli/src/gta6/hashes/mod.rs similarity index 99% rename from crates/tools/or-cli/src/gta6/hashes.rs rename to crates/tools/or-cli/src/gta6/hashes/mod.rs index 76080cdd7..3f9deb5e9 100644 --- a/crates/tools/or-cli/src/gta6/hashes.rs +++ b/crates/tools/or-cli/src/gta6/hashes/mod.rs @@ -947,5 +947,4 @@ fn load_names(dir: Option<&Path>) -> Vec { } #[cfg(test)] -#[path = "hashes_tests.rs"] mod tests; diff --git a/crates/tools/or-cli/src/gta6/hashes_tests.rs b/crates/tools/or-cli/src/gta6/hashes/tests.rs similarity index 100% rename from crates/tools/or-cli/src/gta6/hashes_tests.rs rename to crates/tools/or-cli/src/gta6/hashes/tests.rs diff --git a/crates/tools/or-cli/src/gta6/import/geometry.rs b/crates/tools/or-cli/src/gta6/import/geometry/mod.rs similarity index 99% rename from crates/tools/or-cli/src/gta6/import/geometry.rs rename to crates/tools/or-cli/src/gta6/import/geometry/mod.rs index bd81ced53..7eb0873b9 100644 --- a/crates/tools/or-cli/src/gta6/import/geometry.rs +++ b/crates/tools/or-cli/src/gta6/import/geometry/mod.rs @@ -274,5 +274,4 @@ pub fn replace_gta6_geometry( } #[cfg(test)] -#[path = "geometry_tests.rs"] mod tests; diff --git a/crates/tools/or-cli/src/gta6/import/geometry_tests.rs b/crates/tools/or-cli/src/gta6/import/geometry/tests.rs similarity index 100% rename from crates/tools/or-cli/src/gta6/import/geometry_tests.rs rename to crates/tools/or-cli/src/gta6/import/geometry/tests.rs diff --git a/crates/tools/or-cli/src/gta6/names_mine/named.rs b/crates/tools/or-cli/src/gta6/names_mine/named/mod.rs similarity index 99% rename from crates/tools/or-cli/src/gta6/names_mine/named.rs rename to crates/tools/or-cli/src/gta6/names_mine/named/mod.rs index 6783ec4e1..0fc49bb0a 100644 --- a/crates/tools/or-cli/src/gta6/names_mine/named.rs +++ b/crates/tools/or-cli/src/gta6/names_mine/named/mod.rs @@ -1086,5 +1086,4 @@ fn prop_tails(words: &[String]) -> Vec { } #[cfg(test)] -#[path = "named_tests.rs"] mod tests; diff --git a/crates/tools/or-cli/src/gta6/names_mine/named_tests.rs b/crates/tools/or-cli/src/gta6/names_mine/named/tests.rs similarity index 100% rename from crates/tools/or-cli/src/gta6/names_mine/named_tests.rs rename to crates/tools/or-cli/src/gta6/names_mine/named/tests.rs diff --git a/crates/tools/xtask/src/slow_tier.rs b/crates/tools/xtask/src/slow_tier.rs index ff264fe1e..024a19d0b 100644 --- a/crates/tools/xtask/src/slow_tier.rs +++ b/crates/tools/xtask/src/slow_tier.rs @@ -79,7 +79,7 @@ const ALWAYS_SLOW: &[&str] = &[ /// Modules of the app that are slow whatever a run timed them at, for the same reason. const ALWAYS_SLOW_OF_THE_APP: &[&str] = - &["state::gta6_world::worldview::reference::of_the_install"]; + &["state::gta6::world::gta6_world::worldview::reference::of_the_install"]; const BEGIN: &str = "# slow-tier:begin"; const END: &str = "# slow-tier:end"; diff --git a/docs/direction/GTA_VI_Platforms_Plan.md b/docs/direction/GTA_VI_Platforms_Plan.md index 9a69bc54d..8b95d155b 100644 --- a/docs/direction/GTA_VI_Platforms_Plan.md +++ b/docs/direction/GTA_VI_Platforms_Plan.md @@ -65,13 +65,13 @@ Read at `6b1dda52`. Each is a fact of one build written as a fact of the game. - `Rpf9Header::broken_rule` in `crates/io/or-io/src/container/rpf/rpf9/mod.rs` holds one table of constants, the Xbox's, and every other rule there was measured on Xbox headers alone. `crates/io/or-io/src/container/rpf/rpf9/gta6_container_build.rs` writes the Xbox letter and byte into every archive it builds. - The platform letter is read and nothing in `or-io` decides by it; the app shows it in a row's extension, and falls back to the Xbox's where no table opened. The list of letters exists twice in `or-io` (`RAGE_PLATFORM_LETTERS` and a copy in the header's rules) and a third time as `Platform::extension_letter` in `or-title`. - RPF9 is no layout behind `RpfArchive`: it is a side state and a branch in each of `crates/io/or-io/src/container/rpf/reader.rs` and `crates/io/or-io/src/container/rpf/archive.rs` where the version is RPF9. -- A table's keys come from process state. `Gta6Context` in `crates/io/or-io/src/container/rpf/rpf9/gta6_rpf.rs` is a global that reads environment variables once and keeps the result, errors included; the provider an archive is opened with is ignored for RPF9. The app keeps one key set for the process in `src/state/rpf9_table.rs` and gives it to that global, so two builds cannot be open at once, and the CLI loads keys through two functions that do the same. +- A table's keys come from process state. `Gta6Context` in `crates/io/or-io/src/container/rpf/rpf9/gta6_rpf.rs` is a global that reads environment variables once and keeps the result, errors included; the provider an archive is opened with is ignored for RPF9. The app keeps one key set for the process in `src/state/rpf/rpf9_scan/rpf9_table/mod.rs` and gives it to that global, so two builds cannot be open at once, and the CLI loads keys through two functions that do the same. - The key code names one build. `crates/io/or-io/src/container/rpf/rpf9/gta6_extract.rs` lists a single build, reads it as a PE in one of two PE readers the tree holds, and keeps one cache file, `gtavi_keys_cache.dat`, for every install; `GtaViKeys` records no platform, and a snapshot is used without holding its recorded executable to the build it is used on. - `crates/io/or-io/src/container/rpf/rpf9/rpf9_scan/mod.rs` is built on zlib heads from end to end, and the readers of `crates/io/or-io/src/container/rpf/rpf9/gta6_mount.rs` and `crates/io/or-io/src/container/rpf/rpf9/gta6_chunk_table.rs` assume zlib where a chunk is not stored. **Textures.** -- `crates/io/or-io/src/gta6/ttpf.rs` takes `RDS5` as the pack's magic and the directory as its row 0, so the envelope and the pack are one type. +- `crates/io/or-io/src/gta6/ttpf/mod.rs` takes `RDS5` as the pack's magic and the directory as its row 0, so the envelope and the pack are one type. - `crates/io/or-io/src/gta6/tiling.rs` is the Xbox tile order with no name that says so, and `crates/io/or-io/src/gta6/headerless/texture.rs` refuses any tile mode but the one measured. **Titles and installs, in `or-title`.** @@ -83,7 +83,7 @@ Read at `6b1dda52`. Each is a fact of one build written as a fact of the game. **Walking an install.** -- Six functions list a GTA VI install's archives, each its own walk of the disk: `crates/domain/or-world-gta6/src/index_mount.rs`, `src/state/gta6_install_scan.rs`, `crates/tools/or-cli/src/rpf/rpf9/mod.rs`, `crates/tools/or-cli/src/gta6/install.rs`, `crates/tools/or-cli/src/gta6/hashes.rs` and `crates/tools/or-cli/src/gta6/names_mine/mod.rs`. Two more list its packs. None goes through `crates/title/or-title/src/install/crawl.rs`, and none knows a `_concat` file, so each would list every pair as two unrelated archives. +- Six functions list a GTA VI install's archives, each its own walk of the disk: `crates/domain/or-world-gta6/src/index/mount/mod.rs`, `src/state/gta6/install/gta6_install_scan.rs`, `crates/tools/or-cli/src/rpf/rpf9/mod.rs`, `crates/tools/or-cli/src/gta6/install.rs`, `crates/tools/or-cli/src/gta6/hashes/mod.rs` and `crates/tools/or-cli/src/gta6/names_mine/mod.rs`. Two more list its packs. None goes through `crates/title/or-title/src/install/crawl.rs`, and none knows a `_concat` file, so each would list every pair as two unrelated archives. - The executable is looked for in four places, three of them by the `.exe` ending, and the app reads `common.rpf`, `levels.rpf`, `textures.rpf` and `shaders.rpf` by name, each as one file. **Shaders.** diff --git a/docs/direction/Project_Context.md b/docs/direction/Project_Context.md index b6d9d0a5d..1168baf0a 100644 --- a/docs/direction/Project_Context.md +++ b/docs/direction/Project_Context.md @@ -51,7 +51,7 @@ Offered four ways to draw a world for several games, the owner chose: "option C Asked who moves the GTA VI world viewer out of the app and behind the contract, the owner answered that this programme does, and that "the gta vi other session work is paused meanwhile". -- **What it means for a lane.** Until the app holds one world session ([R71c](Roadmap.md#r71c-one-world-session-one-frame-host-and-panels-by-capability)), no lane outside the programme edits `src/state/gta6_worldview/`, the world files of `src/render/viewport/` or the World panel. How long "meanwhile" lasts was not said; the plan takes it as until R71c's first part merges and [asks](Unified_World_Plan.md#asked-of-the-owner). +- **What it means for a lane.** Until the app holds one world session ([R71c](Roadmap.md#r71c-one-world-session-one-frame-host-and-panels-by-capability)), no lane outside the programme edits `src/state/gta6/world/gta6_world/worldview/`, the world files of `src/render/viewport/` or the World panel. How long "meanwhile" lasts was not said; the plan takes it as until R71c's first part merges and [asks](Unified_World_Plan.md#asked-of-the-owner). - **The pause on every agent is lifted.** The owner had paused all agents earlier that day, and lifted that pause with the go-ahead: "option C like you said, i lift the pause yes, write the plan". The plan is [Unified_World_Plan.md](Unified_World_Plan.md), and nothing of it is built. - **What it does not move.** GTA VI's script decompiler and its model viewport are no part of the viewer. diff --git a/docs/direction/Roadmap.md b/docs/direction/Roadmap.md index 7350d0e9c..a74db2695 100644 --- a/docs/direction/Roadmap.md +++ b/docs/direction/Roadmap.md @@ -975,12 +975,12 @@ which every bulk operation has to plan for. nested archive saves back through the outermost archive that is on disk. **Where it stands.** Done. Rebuilding an archive, whether an install's tree saves it or it is open -as a document of its own, writes each archive nested in it as one entry (`src/state/rpf_records.rs`): +as a document of its own, writes each archive nested in it as one entry (`src/state/rpf/rpf_records.rs`): the bytes its parent stores for it, or, once anything inside it was edited, a rebuild from its own records, recursively, under the encryption it was read with. An edit marks every archive around it unsaved, so the edit gate is asked about the archive on disk that holds it and that archive is the one saved; saving it marks the archives nested in it saved. The save destination chooser offers -that archive on disk for an entry of a nested archive. `src/state/nested_archives_survive_a_save.rs` +that archive on disk for an entry of a nested archive. `src/state/tests/nested_archives_survive_a_save.rs` holds both clauses: untouched nested archives, one browsed and one never opened, read back byte for byte and still open, and an edit two archives deep reads back from disk whether it was saved from its tab or with the install's tree. Two gaps found while closing it are @@ -1012,7 +1012,7 @@ the save and names the entry. `Ctrl+S` on a folder opened with Open Folder saves in it, as an install's tree does. Renaming or moving an opened archive on disk, or a folder that holds one, carries every row below it and every archive opened there to the new path with their unsaved edits (`moved_on_disk`), since an opened archive reads and saves the path it holds. -`src/state/saving_twice_and_into_an_archive_not_yet_opened.rs` holds the four +`src/state/tests/saving_twice_and_into_an_archive_not_yet_opened.rs` holds the four clauses and the rename; each failed before its fix. A file moved between two archives, and an extraction running across a save, read the replaced file until [R20e](#r20e-two-readers-of-one-archive-across-a-save) closed both. @@ -1055,7 +1055,7 @@ archive it left is refused, naming it, until the archive now holding it is saved one press saves both. A save of an archive an extraction reads is refused with a sentence naming the extraction, as a defragment's is, so the job reads the file it was planned from to its end. -`src/state/two_readers_of_one_archive_across_a_save.rs` holds both clauses and the nested archive's +`src/state/tests/two_readers_of_one_archive_across_a_save.rs` holds both clauses and the nested archive's refusal; each failed before its fix. **Done when.** A test moves a file between two archives, saves the one it left and then the other, @@ -1086,7 +1086,7 @@ expansion begun before a save or a defragment replaced its file is listed again. opens an archive row first, as an add does, and since [R20g](#r20g-what-archive-rows-still-get-wrong) every archive nested in it as well. The session's unread unsaved flag is gone. -`src/state/a_moved_or_deleted_archive_row_leaves_nothing_behind.rs` holds each clause, and each +`src/state/tests/a_moved_or_deleted_archive_row_leaves_nothing_behind.rs` holds each clause, and each failed before its fix. **Done when.** A test moves a row with an open tab between archives and finds its save destination, @@ -1115,7 +1115,7 @@ eight deep, on the UI thread ([R20h](#r20h-what-archive-rows-still-get-wrong-aft to the expansion workers). A folder dropped onto itself or a folder inside it is refused before the edit gate asks, by the check a paste made, now shared and comparing paths as the disk names them. Unloading an archive forgets its slots. Two archives that each hold a nested archive moved -out of the other still never save. `src/state/what_archive_rows_still_get_wrong.rs` holds each +out of the other still never save. `src/state/tests/what_archive_rows_still_get_wrong.rs` holds each clause, and each failed before its fix. What it left is [R20h](#r20h-what-archive-rows-still-get-wrong-after-r20g)'s. @@ -1152,7 +1152,7 @@ says it is not read until it is opened. `reparent` gives a new handle to every n reads through the archive renamed, wherever its row now sits, so a nested archive moved out of one archive still reads and saves once that one is renamed on disk. `register_archive` refuses with an error once the ids are used, where it panicked. -`src/state/a_rename_on_disk_waits_for_the_extraction_reading_it.rs` holds each clause, and each of its tests +`src/state/tests/a_rename_on_disk_waits_for_the_extraction_reading_it.rs` holds each clause, and each of its tests failed before its fix, or with the fix taken out, except two: the guard that an archive which will not open ends the wait, which no earlier design failed, and the move half of the refused rename, which [R25j](#r25j-a-drag-carries-every-selected-row) already held. What is left: a renamed @@ -1194,7 +1194,7 @@ move on disk, an undo or redo, a defragment and an overlay refresh still ask `no also holds the files its rows sit in or are, as [R20h](#r20h-what-archive-rows-still-get-wrong-after-r20g) left them: the last two unload the archive's row, so an archive already open under the rows is held as well. -`src/state/an_extraction_holds_back_only_the_files_it_reads.rs` holds the drag, the save, the defragment +`src/state/tests/an_extraction_holds_back_only_the_files_it_reads.rs` holds the drag, the save, the defragment and refresh, the count that reads nothing and the mended archive, and `src/ui/tests/the_counts_of_only_one_type_read_nothing_until_clicked.rs` drives the real menu; each failed before its fix, or with the fix taken out. What is left: a drag out of a very large selection, an @@ -1335,7 +1335,7 @@ background jobs, and stops from there. A tree edit, a save, and each opening of again, reopening only the archives on disk whose size or time changed. "Search every archive" reads the same index, per document, so two expanded archives' searches both arrive and an install's reaches inside its archives; it draws its first thousand matches, and is no longer a job of its -own. A file already open focuses its tab, as R59l's opens do. `src/state/going_to_a_file.rs` holds +own. A file already open focuses its tab, as R59l's opens do. `src/state/tests/going_to_a_file.rs` holds the three clauses on a temporary install opened cold, the adder two archives deep, with the fuzzy ranking, the scope, both searches and a file found once its save lands; each failed before its fix. An edit inside an archive reaches the index once it is saved. Seen on `just shots` screens, not in @@ -1360,7 +1360,7 @@ opens it through the tree's own open (`open_rpf_entry`), or extracts it. A resul clicks as the tree does, and Extract… writes every selected result in its decoded form through the extraction job, which asks once whether to replace files already in the folder. Reveal in tree clears the tree's filter and brings the Hierarchy panel forward, so the row it selects is drawn. The -cases in `src/state/search_results_that_open.rs` click the rows through real frames, each hit +cases in `src/state/tests/search_results_that_open.rs` click the rows through real frames, each hit inside an archive the tree had not opened. **Done when.** Every result row offers Open, Reveal and Extract, and a test opens a result through @@ -1414,7 +1414,7 @@ that `TextDocument::open` refuses, opens read-only as `DocumentKind::Hex` leading magic where that is known, and offset, hex and ASCII rows. A save is refused and the New menu never offers the kind. It opens so from disk, from a drop, from history and from an archive entry's double-click or Open (`a_binary_dat_with_no_reader_opens_as_hex_under_its_refusal`, -`an_archive_entry_no_reader_opens_opens_as_hex` in `src/state/opening_an_unknown_file.rs`). A text +`an_archive_entry_no_reader_opens_opens_as_hex` in `src/state/tests/opening_an_unknown_file.rs`). A text `.dat` opens as text (#421), and a file of any unknown extension whose bytes start with a UTF-16 byte order mark, or are valid UTF-8 with no NUL in their first 8 KiB, opens as editable text and saves its bytes back (#445, `an_unknown_extension_holding_text_opens_as_editable_text`). @@ -1446,7 +1446,7 @@ pane that draws a texture, a model and text as their views do, and hex for the r panel's keys do; `F2` and `Delete` run through R25e on the keys the user bound them to, the key dispatcher's, and the panel reads neither ([R59u](#r59u-small-faults-in-the-editor-and-the-previews)). A row's menu adds Reveal in Windows Explorer, Copy name, Copy hash, Export as… and Properties, and New folder edits its name in place -(`src/state/the_files_view_in_the_centre/`). Nothing opens a row in another program or replaces an +(`src/state/tests/the_files_view_in_the_centre/`). Nothing opens a row in another program or replaces an entry's bytes yet, so Open with and Replace are not offered; a model's render is untextured. Seen on `just shots` screens, not in a window. @@ -1508,7 +1508,7 @@ offers Copy and Paste of its field, a vector or a colour whole, over a field of refusing another with a sentence, as one step of the grid's own writes (`AppState::patch_scalars`). Ticked records copy from the form or Edit and paste after the last record ticked in another file, refusing a type the array does not hold, and Edit's Delete takes ticked records out. -`src/state/copy_cut_and_paste/` holds the Done-when's three tests +`src/state/tests/copy_cut_and_paste/` holds the Done-when's three tests (`a_file_copied_in_one_archive_pastes_into_another_and_into_explorer`, `a_vector_copied_from_one_field_pastes_into_another`, `a_metadata_record_copied_from_one_file_pastes_into_another`) and the cut, gate, nested archive, @@ -1565,7 +1565,7 @@ either holds that name, the folder's unscanned files included. On an archive row [R20c](#r20c-saving-twice-and-into-an-archive-not-yet-opened) does, and what they add stays in the session, counted unsaved, until a save writes it. A rebuilt archive keeps an empty folder, which it dropped before because no file's path named it (`RpfBuilder::mkdir`). -`src/state/every_add_lands_where_the_tree_shows_it.rs` runs the three commands on a folder on disk, +`src/state/tests/every_add_lands_where_the_tree_shows_it.rs` runs the three commands on a folder on disk, an archive on disk and an archive nested in one; four of the nine failed before the fix: New file in the folder stayed in memory, New folder and Copy into archive on the archive on disk failed with OS errors 183 and 3, and the save dropped New folder in the nested archive. A move onto an archive row @@ -1595,7 +1595,7 @@ afterwards act on that row: with two trees listed and the selection in the other renames it with F2 and finds Ctrl+Z undoing that rename and not the other tree's; `a_file_dropped_onto_files_gives_files_focus` and `the_start_of_a_drag_selects_its_row_and_gives_its_panel_focus` hold the rest -(`src/state/a_right_click_or_a_drag_selects_its_row.rs`). Each of the three failed before the +(`src/state/tests/a_right_click_or_a_drag_selects_its_row.rs`). Each of the three failed before the change. `promote_pending_rename` takes its rename without an `unwrap`. A document's own row in Files and the Files view's empty space still select nothing on a right click. Seen on `just shots` screens, not in a window. @@ -1613,7 +1613,7 @@ Explorer already takes them all, and a drag never opens a rename. **Where it stands.** Done. A drop onto a folder row in Files or the Files view moves the rows the drag carries (`maybe_drop_into_folder`): the selection when it holds the row dragged, the rule the drag out to Explorer now shares (`Selection::dragged`); let go over one of those rows, the drag -went nowhere. They move through `src/state/rpf_moves.rs`, which a single move (Move to, a cut's +went nowhere. They move through `src/state/rpf/rpf_moves.rs`, which a single move (Move to, a cut's paste) now takes too: a row inside another goes with it; a drop into a folder inside a row it carries is refused, naming the row, before the edit gate asks; the gate is asked once for the folder and every archive or folder the rows leave, so one Yes moves them all and a refusal moves @@ -1626,7 +1626,7 @@ it would land in (`no_job_reads`, since [R60i](#r60i-what-a-write-still-does-not stays where it was and is named with why ("Moved 2 item(s); 1 failed: …"), and the rest move, as a paste's rows do. The start of a drag cancels the rename a slow click on its row scheduled (`start_drag`). -`src/state/a_drag_carries_every_selected_row.rs` holds the Done-when's two tests, +`src/state/tests/a_drag_carries_every_selected_row.rs` holds the Done-when's two tests, `three_rows_selected_and_one_dragged_onto_a_folder_all_move_and_undo_together`, in Files and in the Files view, and `a_row_slow_clicked_and_then_dragged_opens_no_name_editor`, and one each for the gate, a folder dropped into itself, a name taken and a job reading a row; each failed before @@ -1658,7 +1658,7 @@ swallowed every row beside it, and a click on a row in the Files view takes the of the selection (`leave_folder_shown`), where going into the folder had selected it and a drag or Copy carried it with everything in it. `rpf_rename_node` returns before the gate when the name is the row's own, as the editor's own commit of an unchanged name already did. -`src/state/a_drag_copies_and_a_change_of_nothing_does_nothing.rs` holds the Done-when's tests, +`src/state/tests/a_drag_copies_and_a_change_of_nothing_does_nothing.rs` holds the Done-when's tests, `a_row_dropped_onto_a_folder_with_ctrl_held_is_copied_and_one_ctrl_z_takes_the_copy_away` in Files and in the Files view, `a_selection_holding_the_folder_being_viewed_copies_and_drags_its_other_rows`, @@ -1709,7 +1709,7 @@ mode refused a write" in the two [R26c](#r26c-uses-reaches-every-pack) runs is n rename that changes nothing already did not ask the gate. The test of a selection holding the viewed folder fails before the fix through `leave_folder_shown` and not `top_rows`, whose half a direct call to `copy_rows` holds; no test undoes a copy of several rows as one step; and `rpf_copy_nodes` -is not among the writes `src/state/the_gate_in_front_of_every_write.rs` lists, so its gate stands +is not among the writes `src/state/tests/the_gate_in_front_of_every_write.rs` lists, so its gate stands only because it calls `import_paths_into_folder`. **Done when.** A test pastes a cut into the folder its rows sit in and finds the cut still on the @@ -1880,7 +1880,7 @@ Uses says so in words. The file index cannot stand in for the catalogue: it list order a folder walk meets them, not the mount's, where `update.rpf` and the DLC packs override the base game and the mods overlay comes first, so a name a later pack ships would resolve to a copy the game never loads; and the type files, manifests and model bodies are read through the mount -anyway. `src/state/uses_and_used_by_in_the_app.rs` builds an install whose `.ytyp` and `.ymap` are +anyway. `src/state/tests/uses_and_used_by_in_the_app.rs` builds an install whose `.ytyp` and `.ymap` are PSO written from a schema it declares, so it runs with no schema snapshot: `a_drawables_uses_lists_its_texture_dictionary_and_opens_it` finds the menu looking, then the texture dictionary listed among exactly the files `openrage-cli depends export` copies with the @@ -1906,7 +1906,7 @@ its click said it no longer existed. A sub-pack's device now carries the contain nested in the title update, and a nested sub-pack's `MountRoot` names that whole chain where it named only the part inside its holder (`crates/title/or-title/tests/a_dlc_sub_packs_files_say_where_they_sit.rs`). -`src/state/uses_reaches_every_pack.rs` builds an install whose `dlc1.rpf` holds a texture +`src/state/tests/uses_reaches_every_pack.rs` builds an install whose `dlc1.rpf` holds a texture dictionary and a map: `a_file_a_dlc_sub_pack_holds_opens_from_uses` opens the dictionary from the drawable's Uses, beside the files `openrage-cli depends export` copies, and `a_map_a_dlc_sub_pack_holds_opens_from_placed_by` opens the map from Placed by. A map's Uses now @@ -1964,7 +1964,7 @@ of a file where its device can, `ArchiveDevice` reads that much of a resource's (`RpfArchive::read_prefix`), a file cut short opens to the front of its payload as `Rsc7::open` always kept what a cut stream inflated to, and `ModelContents::read_bound` takes the box from the first 4,096 bytes. `a_maps_first_uses_reads_each_of_its_bounds_for_its_header_alone` -(`src/state/uses_over_a_retail_install.rs`) mounts a recording device over the install's archive, +(`src/state/tests/uses_over_a_retail_install.rs`) mounts a recording device over the install's archive, asks `DependencyIndex::map_boxes_of` for a map whose two `.ybn` hold 100,000 bytes past their header, and finds each read once, for under a tenth of the file, with their inside and OUTSIDE verdicts unchanged; it failed first with `plain_map_0.ybn was read for 105801 bytes`. Over the retail @@ -2101,7 +2101,7 @@ a drawable or a `.dds`; a stream's replace; a text table's entries; a movie's im session's added folders and files, imports, renames, moves and deletes while unsaved. ⚠ A write of an archive empties a history holding rows taken out of one, whose entries the write renumbers; a rename, move or delete on disk is done at once and is not undone, but for the delete a paste makes -of a cut row, which since [R27m](#r27m-an-undo-finishes-or-says-why) is part of the paste's step. `src/state/every_edit_undoes.rs` +of a cut row, which since [R27m](#r27m-an-undo-finishes-or-says-why) is part of the paste's step. `src/state/tests/every_edit_undoes.rs` and a test beside each editor's own edit, undo and find the document as it opened, and undoing in one document leaves another untouched; each failed with the recording, the folding or the saved mark taken out. A plugin's patch of the resource image is one step of Undo. Not undone: an entry @@ -2131,7 +2131,7 @@ an unsaved edit writes the image, moving only the edited bytes. The grid and its document their rows were read from (`draw_editable_summary` in `src/ui/panels/inspector/structure.rs`), so a pinned inspector edits the pinned document. ⚠ An edit that leaves an image its reader refuses stays in the image alone, so only the next save writes it. -`src/state/an_edit_stays_where_it_was_made.rs` saves and reopens a staged Legacy drawable after +`src/state/tests/an_edit_stays_where_it_was_made.rs` saves and reopens a staged Legacy drawable after grid, material and step-less edits in each order and after an undo, drags and pastes in an inspector pinned to an Enhanced drawable, and finds a twelve-frame drag read back once. The two Done-when tests failed before the change, and each other fails with the read, merge, clearing or @@ -2188,7 +2188,7 @@ new image with the contents decoded from it, as a live reload of a `.ypt` brings counts only once read back: a drag in the grid writes the image every frame and the contents once it ends, so a key on the edit count would build the unchanged contents every frame and then miss the read. `two_edits_before_a_save_each_draw_the_drawable_again` -(`src/state/the_viewport_draws_every_edit.rs`) computes the three keys as the viewport compares them +(`src/state/tests/the_viewport_draws_every_edit.rs`) computes the three keys as the viewport compares them for a staged Legacy drawable: unchanged by a frame of a grid drag, changed by its read at the gesture's end, by a material edit and by undoing it. With the keys on the unsaved mark it failed at the read, at the second edit and at the undo, and @@ -2247,7 +2247,7 @@ adds and deletes, and their undos; a bake of pose keys empties the history ([R27c](#r27c-undo-for-every-edit)) and drops the image, so a clip dictionary's grid, drawn since [R31d](#r31d-undo-and-the-sliders-follow-the-pinned-inspector), asks for a fresh one. `a_grid_edit_and_the_material_edit_after_it_both_undo` and `the_declared_grid_is_drawn_and_editable_after_a_material_edit` -(`src/state/the_grid_and_undo_survive_an_edit_of_the_contents.rs`) failed before the change; two +(`src/state/tests/the_grid_and_undo_survive_an_edit_of_the_contents.rs`) failed before the change; two tests with no corpus fail with the swap, the keeping or the cap taken out. Seen on `just shots` screens, not in a window. @@ -2271,7 +2271,7 @@ resolves. In the Animation workspace the mesh key also counts each mesh source's source's changes (`anim_scene_signature` in `src/render/viewport/retarget.rs`), since the active document is often none of them. `a_reencoded_or_imported_embedded_texture_is_uploaded_again_and_no_other` -(`src/state/every_view_follows_every_edit.rs`) re-encodes the embedded texture a staged Legacy +(`src/state/tests/every_view_follows_every_edit.rs`) re-encodes the embedded texture a staged Legacy drawable's meshes bind, imports two images of one size over it and undoes each, and finds that texture's copies for the viewport and a thumbnail uploaded again, its neighbour's kept and the count true; with the stamp ignored it failed at the re-encode, and with the stored bytes left out @@ -2327,7 +2327,7 @@ where no mesh source is named ([R27o](#r27o-the-animation-preview-follows-its-so the badge and the status bar report the same resolution. ⚠ The viewport keeps one GPU copy for each name, so two sources that embed one name with other pixels are uploaded again on every build, and each draw still binds its own. `an_edit_to_a_bone_of_the_skeleton_source_poses_the_skeleton_again` -(`src/state/the_animation_preview_draws_what_its_sources_hold.rs`) writes a rigged drawable of each +(`src/state/tests/the_animation_preview_draws_what_its_sources_hold.rs`) writes a rigged drawable of each target, edits a bone in the grid while a clip dictionary is active, and finds the bone and its world matrix posed again once the edit is read back and again at its undo, and the session not built again for a frame of the drag; it failed at the bone's new place before the change, and at the drag with @@ -2399,7 +2399,7 @@ with both other edits kept; `ctrl_z_in_files_undoes_a_rename_from_a_rows_menu` renames from the row's menu instead; `the_history_panel_opened_from_files_lists_and_undoes_the_rename_made_there` finds History opened from Files listing the rename and not the drawable's edit -(`src/state/undo_from_files_acts_on_what_files_shows.rs`). A folder on disk opens as a document of +(`src/state/tests/undo_from_files_acts_on_what_files_shows.rs`). A folder on disk opens as a document of its own, and an archive in it is part of that document, so a change inside the archive undoes there; a rename, move, delete or import of a file on disk is made at once and is no step, so Undo does not take it back and reaches no other document; since @@ -2434,7 +2434,7 @@ the saved mark and mark an archive saved that still holds a dropped step's chang Undo would leave such a step above every other. `a_rename_move_or_delete_on_disk_beside_an_archive_leaves_the_steps_inside_it_to_undo` and `an_archive_renamed_and_moved_on_disk_undoes_and_redoes_the_rename_inside_it_where_it_now_is` -(`src/state/a_change_on_disk_keeps_the_undo_steps_beside_it.rs`) failed before the change, the +(`src/state/tests/a_change_on_disk_keeps_the_undo_steps_beside_it.rs`) failed before the change, the first fails again with the reach check taken out, and the second with any reach emptying the history; `a_delete_on_disk_of_a_folder_holding_an_opened_archive_leaves_no_step_that_cannot_undo` fails with @@ -2466,7 +2466,7 @@ change cannot go; above it, it stays. Dropping the step without moving the mark [R27l](#r27l-a-change-on-disk-keeps-the-undo-steps-beside-it) rejected, since the undos left could reach a saved mark the kept change made false. Any other document empties its history as before: its steps name places by path or index, which the kept change may have moved. A row on disk cut and -pasted into an archive is part of the paste's step (`Cut` in `src/state/rpf_undo.rs`): undone, its +pasted into an archive is part of the paste's step (`Cut` in `src/state/rpf/rpf_undo.rs`): undone, its files are written back where they were from the pasted copy and its rows go back into the tree; redone, it goes to the Recycle Bin again. Written back, not restored from the bin, which no call restores from and which outside Windows deletes for good; the copy holds the bytes, in memory until @@ -2475,7 +2475,7 @@ first asks the jobs that read files and the edit gate, and a refusal leaves it i stand-in under a self-check leaves the file, so nothing is written back. `an_undo_whose_row_a_refresh_dropped_changes_nothing_says_why_and_the_older_steps_still_undo` and `undoing_a_cut_and_paste_into_an_archive_puts_the_cut_file_back_where_it_was` -(`src/state/an_undo_finishes_or_says_why.rs`) failed before the change, the first half undoing the +(`src/state/tests/an_undo_finishes_or_says_why.rs`) failed before the change, the first half undoing the paste, the second leaving the file in the bin; the first fails again with the flip back, the marks put back, the History panel's row, the step left alone or the saved mark's rule taken out. A cut folder, a cut into another document's archive, the edit gate, a job reading the folder and the @@ -2510,7 +2510,7 @@ finds the row back in the archive and no file left on disk; a test cuts a file f tree into another's archive, undoes, and finds the first tree listing it without a Refresh; a test undoes a step the edit gate would ask about and finds the question asked; a test flips a spawner-name step and a new-entry step and finds false only where nothing changed; and a test -recycles two folders of one name through the stand-in. The clauses hold in the tree, each seen failing first: the two swaps that could change something and say false now say it only where nothing changed (`a_new_entry_that_cannot_come_back_because_its_name_is_taken_changes_nothing`: `NewEntry` put its texture over the entry of that name and said false; `spawner_names_that_cannot_all_go_back_change_none_of_them`: `SpawnerNames` put the names back that it reached before the place that was gone); the Recycle Bin's stand-in numbers a second item of one name as a real bin does (`two_folders_of_one_name_are_both_taken_as_a_real_bin_takes_them`); and an undo or a redo the gate would ask about asks, holding the step, and the answer takes it through (`PendingRetailEdit::Step`, in `undoing_a_cut_asks_the_edit_gate_before_it_writes_the_file_back`); and a cut of an archive row pasted into a folder on disk is undone whole, since a file written into a folder on disk now records a step that takes it back (`Written` in `src/state/rpf_undo.rs`, held by `undoing_a_cut_of_an_archive_row_pasted_into_a_folder_on_disk_puts_it_back_whole`, which also redoes it and finds a file changed since not deleted); and a file cut from one document's tree into another's archive is listed again by the tree it left once the undo has written it back, since the step names that document and the undo has it read the folder again (`Swap::leaves_a_tree_stale`, held by `undoing_a_cut_between_two_trees_lists_the_file_in_the_tree_it_left_without_a_refresh`, which fails by timeout when the read is taken out). All five clauses hold. +recycles two folders of one name through the stand-in. The clauses hold in the tree, each seen failing first: the two swaps that could change something and say false now say it only where nothing changed (`a_new_entry_that_cannot_come_back_because_its_name_is_taken_changes_nothing`: `NewEntry` put its texture over the entry of that name and said false; `spawner_names_that_cannot_all_go_back_change_none_of_them`: `SpawnerNames` put the names back that it reached before the place that was gone); the Recycle Bin's stand-in numbers a second item of one name as a real bin does (`two_folders_of_one_name_are_both_taken_as_a_real_bin_takes_them`); and an undo or a redo the gate would ask about asks, holding the step, and the answer takes it through (`PendingRetailEdit::Step`, in `undoing_a_cut_asks_the_edit_gate_before_it_writes_the_file_back`); and a cut of an archive row pasted into a folder on disk is undone whole, since a file written into a folder on disk now records a step that takes it back (`Written` in `src/state/rpf/rpf_undo.rs`, held by `undoing_a_cut_of_an_archive_row_pasted_into_a_folder_on_disk_puts_it_back_whole`, which also redoes it and finds a file changed since not deleted); and a file cut from one document's tree into another's archive is listed again by the tree it left once the undo has written it back, since the step names that document and the undo has it read the folder again (`Swap::leaves_a_tree_stale`, held by `undoing_a_cut_between_two_trees_lists_the_file_in_the_tree_it_left_without_a_refresh`, which fails by timeout when the read is taken out). All five clauses hold. ### R27o The Animation preview follows its sources fully @@ -2637,7 +2637,7 @@ scaled and turned to that skeleton's forward kinematics, with a unit test worked (`a_scaled_bone_that_is_turned_stretches_its_own_axes`); they failed with the scale applied along the parent's axes and left out of the inverse, the first at 0.40 off. `signature_non_chiral` is kept by reading what it hashes, not checked against the files. -**The tests** are in `src/state/a_bones_numbers_can_be_edited.rs`, over a four-bone drawable and +**The tests** are in `src/state/tests/a_bones_numbers_can_be_edited.rs`, over a four-bone drawable and fragment of each target and the smallest staged `.ydr`, `.ydd` and `.yft` of each that holds a bone with bones under it (every Legacy kind and the Enhanced `.yft`; the Enhanced `.ydr` and `.ydd` staged have one bone or none). `a_bones_position_dragged_in_the_inspector_is_saved_with_its_rest_pose_derived_again` @@ -2719,7 +2719,7 @@ skeleton and its bones. The mesh section says "None added — the skeleton file' hidden." while the box is unticked. The preview's other settings (Show bones, Bind-pose ghost, Apply root motion) are `PreviewScene` fields that start at their default each run, so this is the first the preferences keep, and keeping the others is -the owner's to ask for. The tests are in `src/state/the_skeleton_files_own_model_can_be_hidden.rs`: +the owner's to ask for. The tests are in `src/state/tests/the_skeleton_files_own_model_can_be_hidden.rs`: they draw Preview settings and click the box, on a Legacy fragment, drawable and dictionary entry holding one triangle skinned to the root bone of a two-bone rig, and on the two staged Legacy peds (`a_ped_chosen_alone_finds_the_box_ticked_and_the_plane_drawn_until_it_is_unticked`, @@ -2875,7 +2875,7 @@ document's selection is drawn in `SELECTED` (`src/render/skeleton_lines.rs`), it joint, and a click picks the nearest line within 5 pixels before any bound or mesh, as that row: in the Model workspace it is selected and the Outline scrolls to it and shows the bone's fields in the Inspector, and in the Animation workspace it is held in `PreviewScene::picked`, as R42f says. -The tests are in `src/state/a_skeleton_is_seen_without_an_animation.rs`, over a two-bone rig of each +The tests are in `src/state/tests/a_skeleton_is_seen_without_an_animation.rs`, over a two-bone rig of each target held as a drawable, a dictionary's entry and a fragment, and the smallest staged `.ydr` and `.yft` of each target that ships a rest pose for its bones (Legacy's `.ydr` and `.yft` and Enhanced's `.yft`; no staged Enhanced `.ydr` holds a skeleton with a bone above another and a rest @@ -2944,11 +2944,11 @@ clause is met: a decoded extraction or a drag out compares each file's canonical unedited writes, with its bytes, and where any differs asks "Do you want to apply OpenRage export fixes (this will alter the bytes)" first; declining writes the original bytes, and the answer can be remembered in Settings (`src/state/extract_job.rs`, -`src/state/an_export_asks_before_it_alters_the_bytes.rs`). A raw or decrypted extraction is never +`src/state/tests/an_export_asks_before_it_alters_the_bytes.rs`). A raw or decrypted extraction is never canonicalised. The save clause is met: saving a document opened from an archive asks where it goes, naming the archive on disk and the overlay copy, and writes only there (`src/state/save_destination.rs`, `src/ui/panels/save_destination.rs`, -`src/state/a_save_names_its_destination.rs`). Back into the archive rebuilds the archive that holds +`src/state/tests/a_save_names_its_destination.rs`). Back into the archive rebuilds the archive that holds the entry; a loose file leaves the archive's bytes alone and asks the export question where an unedited entry's canonical form differs from its bytes; the overlay writes its copy of the archive with the entry in it, landed under a `.rpf.part` name as R49b's copy is, and the open archive then @@ -3100,7 +3100,7 @@ summary and declared structure at a file's root, each Legacy body's sections, th particle editors and the steps they record, and the read-only bodies of clips, pose databases, shader effects, archives and text. A particle effect's live evolution sliders draw only while its document is active: they drive the preview, which plays the active document. -`src/state/a_pinned_inspector_shows_its_own_document.rs` pins the inspector to a staged Legacy +`src/state/tests/a_pinned_inspector_shows_its_own_document.rs` pins the inspector to a staged Legacy `.ybn`, `.ycd`, `.ydd`, `.ydr`, `.yft`, `.yld`, `.ypt`, `.ytd`, `.fxc` and `.ypdb`, and to a scratch text file, while another of its kind is active: the inspector draws what the pinned file's body draws and nothing only the other's draws @@ -3136,7 +3136,7 @@ document. `ctrl_z_undoes_an_edit_in_a_pinned_inspector_while_the_inspector_has_f inspector pinned to one particle file while another is active and undoes the edit with `Ctrl+Z`, and `the_history_panel_opened_from_a_focused_pinned_inspector_lists_and_undoes_its_files_edits` opens History from that inspector, finds the edit listed and undoes it with `Ctrl+Z` there -(`src/state/undo_and_the_sliders_follow_the_pinned_inspector.rs`); the second also fails with the +(`src/state/tests/undo_and_the_sliders_follow_the_pinned_inspector.rs`); the second also fails with the check for focus moved between frames taken out. The Live Evolutions sliders take their names from the effect whose values they move, the one the preview plays, and their heading names it (`the_live_evolution_sliders_are_named_for_the_effect_the_preview_plays`). A clip dictionary's @@ -3608,7 +3608,7 @@ rather than by `or-io`'s writer, must each decode to their source, and a decoder 0 and 1 in every block fails it. `crates/io/or-io/tests/awc_roundtrip.rs` records no multi-channel skip. -The app opens an `.awc` as its own kind (`src/audio/mod.rs`, `src/state/opening_an_awc.rs`). The +The app opens an `.awc` as its own kind (`src/audio/mod.rs`, `src/state/tests/opening_an_awc.rs`). The inspector lists each single-channel stream and a multi-channel container's interleaved source by name hash, codec, channel count, rate and length; plays one through `rodio` behind the `AudioSink` trait, on every platform; exports one to WAV; and replaces a stream from a 16-bit PCM WAV in the codec it has, through @@ -3632,7 +3632,7 @@ for PCM16, RAGE ADPCM and MP3, whose decode stays in `or-io`, and one for XMA, d `openrage-cli awc export` decodes through the same table. A multi-channel stream's blocks stay `or-io`'s to de-interleave, so the table is asked only whether it decodes each channel's codec. `crates/io/or-media/tests/a_synthetic_awc_opens_through_the_media_interface.rs` holds it over -hand-built containers, and the state tests of `src/state/opening_an_awc.rs` run through it. Sound +hand-built containers, and the state tests of `src/state/tests/opening_an_awc.rs` run through it. Sound plays on every platform: `rodio` is a dependency of every target, and `ci.yml`'s Linux job installs ALSA's headers, `libasound2-dev`, which its `cpal` links. @@ -3766,7 +3766,7 @@ which this decode reads exactly as the originals and FFmpeg within the same tole 121 decode and 199 are refused. The channel transform of a pair is ported with the rest and checked by no shipped file, since all eight are one channel. Streams of silent frames built by hand run the same path with no install, in `crates/io/or-media/tests/a_synthetic_awc_opens_through_the_media_interface.rs`, -`crates/tools/or-cli/src/awc.rs` and `src/state/opening_an_awc.rs`. +`crates/tools/or-cli/src/awc.rs` and `src/state/tests/opening_an_awc.rs`. `openrage-cli awc replace` takes a WAV into a stream by the id `awc info` lists, and `awc export` writes a multi-channel container as one interleaved WAV named for its source stream, `00000000`. @@ -3904,7 +3904,7 @@ The app opens a `.rel` and those `.datNN` extensions as `DocumentKind::Rel` the inspector groups the items by type, lists each by its key, and shows a selected item's typed fields read-only, with a `.dat54` item's three extra bytes beside them. A file whose items do not read typed still opens, says why, and lists its items by class id as bytes. A save writes the -container as it was read and keeps the file's extension. `src/state/opening_a_rel.rs` holds a +container as it was read and keeps the file's extension. `src/state/tests/opening_a_rel.rs` holds a synthetic file of each case to its types, its groups and an unchanged save, and `just self-check` draws the kind. Editing a typed field is not built there; in `or-io` the interiors of a game data file and their rooms are added, edited and removed @@ -4013,7 +4013,7 @@ fuzz that loaded the DLL and called them by address, 700,000 random inputs, with fuzz is not committed, and the pictures below are the standing check. Install-gated and Windows-only, `every_shipped_bink2_matches_its_installs_dll_plane_for_plane` -(`src/state/previewing_a_video.rs`) decodes every Bink 2 movie each install ships twice, with that +(`src/state/tests/previewing_a_video.rs`) decodes every Bink 2 movie each install ships twice, with that install's `bink2w64.dll`, loaded at run time and never bundled, and with `or-media`, four movies at a time and in under five minutes: Legacy's 29 movies, 85,206 frames, with its 1.994a DLL, and Enhanced's 33, 89,859, `KB2g` and `KB2j` alike, up to 3840×2160, with its 2020.07 DLL, and every one of the @@ -4230,7 +4230,7 @@ everything else is schema-driven. keeps (`a_derived_type_manufactures_the_variant_it_came_from`). - **Validation is the save** (#133): `MetaDocument::refresh_validation` calls `to_bytes`, and a refusal is a disabled Save in the writer's own words - (`src/state/document/a_document_that_will_not_save.rs`) that names the element since #185 + (`src/state/document/meta/a_document_that_will_not_save.rs`) that names the element since #185 (`a_refusal_names_the_element_it_stopped_at`). - **What the editor opens** (#414, #439): `.ymap` and `.ytyp` open in it. A metadata XML whose root or pointer type no schema declares, such as `images.meta` and `weather.xml`, reads as the @@ -4238,7 +4238,7 @@ everything else is schema-driven. XML the parser's dialect could not have written is refused by name. A binary `.srl` reads as its frames (`or_io::meta::srl`) and saves byte-identical, and an archive entry is routed by its bytes as a file from disk is (`crates/io/or-io/tests/metadata_without_a_schema.rs`, - `src/state/opening_metadata_without_a_schema.rs`). Of the 529 text `.meta` and `.xml` files in a + `src/state/tests/opening_metadata_without_a_schema.rs`). Of the 529 text `.meta` and `.xml` files in a Legacy `common.rpf`, measured for #439, 422 read that way and reach their own fixed point; the rest, maps keyed by `Item key=`, `content=` arrays, `ref=` and other XML outside the dialect, stay refused. @@ -4387,7 +4387,7 @@ refusal in its words with nothing changed, beside the drawable it replaces and t into the document as one step of its history, and nothing is written until the model is saved. An import is refused wherever its save would be, with the save's reason, so the model it leaves always saves. `a_ydr_exports_and_imports_back_from_its_menus_and_saves_what_the_cli_writes` -(`src/state/gltf_in_and_out_from_the_app.rs`) exports a staged Legacy and an Enhanced `.ydr` from +(`src/state/tests/gltf_in_and_out_from_the_app.rs`) exports a staged Legacy and an Enhanced `.ydr` from its row's menu and finds the bytes written the command's; it then imports a copy of that export lifted 2 m over the model its tab's menu offers the import on, and finds the report the command's, the model unchanged until Replace and one step after it, the viewport building it again with the @@ -4716,7 +4716,7 @@ channel selector fit a narrow viewport; and the box says what the viewport shows kind code or frame rate. A gallery tile's key holds the mode, the channel and the level of detail, and a particle model frames from the sphere its meshes fill rather than the smaller one it ships. `a_click_selects_the_geometry_under_the_cursor_in_the_outline_f_frames_it_and_a_restart_keeps_the_mode` -and the tests beside it in `src/state/viewport_basics_for_inspecting_assets.rs` hold each clause, +and the tests beside it in `src/state/tests/viewport_basics_for_inspecting_assets.rs` hold each clause, for both targets where one is staged, and each failed before its fix; the renderer's half of the bones is `lines_drawn_in_front_show_through_a_mesh_nearer_the_camera`, which needs a GPU. [R42f](#r42f-the-viewport-picks-what-it-draws) widened the click to a bone, a bound and, with Alt, a model, and in the Animation workspace to every mesh the preview draws, and @@ -4849,7 +4849,7 @@ drawn, in place of the clip dictionary. entry or a fragment), `a_click_on_a_bound_selects_its_row_in_the_outline` (both targets, a drawable and a dictionary's entry), `a_click_reaches_a_mesh_source_drawn_beside_a_clip_dictionary`, `a_pick_in_the_animation_workspace_leaves_the_clip_selected_and_the_box_names_it` and the tests -beside them in `src/state/the_viewport_picks_what_it_draws.rs` hold each clause, and each was seen +beside them in `src/state/tests/the_viewport_picks_what_it_draws.rs` hold each clause, and each was seen failing with its part taken out. Not done, and taken up by [R42h](#r42h-what-a-pick-still-misses-after-r42f): ⚠ in the Animation workspace the Outline, the Inspector and the status bar follow the active document, so a pick there shows in the box alone @@ -4930,10 +4930,10 @@ which switches to the workspace that shows its kind, selects the row, sends the brings the Outline forward (`a_double_click_on_the_picked_mesh_opens_its_document_at_the_geometry` and `a_double_click_on_the_picked_bone_opens_its_rig_at_the_bone`, in -`src/state/a_pick_in_the_preview_opens_its_document_at_its_row.rs`, which double click where the box +`src/state/tests/a_pick_in_the_preview_opens_its_document_at_its_row.rs`, which double click where the box paints the line, and hold that one click leaves the clip list and that a double click on the line above it opens nothing). The viewport picks the lines it still missed, in -`src/state/the_viewport_picks_every_line_it_draws.rs`: the bind-pose ghost, as the bone whose segment +`src/state/tests/the_viewport_picks_every_line_it_draws.rs`: the bind-pose ghost, as the bone whose segment it is, named "in the bind pose", the one nearest the cursor in pixels and giving way to the posed bone only where the two are equally near, as at the bind pose (`a_click_on_the_bind_pose_ghost_picks_the_bone_it_draws` and @@ -5044,7 +5044,7 @@ drawn as meshes in the shaded modes carries no line, since `build_bound_meshes` `src/render/bound_meshes.rs` returns its meshes unkeyed, and a `.yld`'s cloth edges and collision composite, a `.ynv`'s outlines, a particle effect's gizmo lines and a plugin's overlay lines are drawn and not picked, though the row's What and its test module say every line is, and its Done-when -names three kinds. `the_outline_selects` in `src/state/viewport_basics_for_inspecting_assets.rs` +names three kinds. `the_outline_selects` in `src/state/tests/viewport_basics_for_inspecting_assets.rs` compares a painted colour with the process-wide palette without holding `crate::ui::theme::serial()`, so a theme test that flips the palette between the draw and the read fails it at random; no test fails with the `workspace_docks.reveal(workspace, OUTLINE)` line of @@ -5057,7 +5057,7 @@ a fragment's physics bound with its section collapsed and finds the section open Outline row of a physics level the viewport does not draw; a test clicks a `.ybn` drawn as meshes in a shaded mode, and each kind of line above, and finds each picked or said not to be; a test takes the Outline send out of `open_picked` and finds a test fail; and a script clicks with Alt and a -screen shows the model selected. Six hold in the tree, each seen failing first: Enter or Space on the focused Picked line opens the pick as a double click does, and its hint says so (`enter_on_the_focused_picked_line_opens_the_pick_as_a_double_click_does`; a screen reader's default action is still not one of them, since it arrives as a single click that the line must not act on); and a fragment's Outline lists a Bound row for the High physics level alone (`the_outline_lists_a_bound_row_for_the_physics_level_the_viewport_draws_and_no_other`, the Medium and Low summary lines staying). A click on a fragment's physics bound opens the Physics section that was closed over its row (`a_click_on_a_physics_bound_opens_the_section_that_holds_its_row`), and a double click on the Picked line queues the Outline's reveal, which `assert_opened_at` in `src/state/a_pick_in_the_preview_opens_its_document_at_its_row.rs` fails without; `the_outline_selects` now holds the theme serial, which only a run in threads (`just test-lite`) could have shown. A click on a `.ybn` drawn as meshes picks the node whose mesh it meets, in the row its Outline gives it (`a_click_on_a_ybns_bounds_picks_the_node_it_draws`, seen failing first), and a click past it leaves the selection where it was, as in Wireframe. A click on a `.ynv`'s polygon selects its row in the Outline, which opens its section and draws it highlighted, and a click on the row selects it as well (`a_click_on_a_navmesh_polygon_selects_its_row_which_the_outline_opens_and_the_viewport_highlights`, each of the four seen failing with its part taken out). The remaining lines say they are not picked, and why: a cloth's edges and its collision composite draw for the cloth that is already the selected row and have no Outline row of their own to select; a particle effect's gizmo lines are drawn for the live particles of the running simulation, which move and have no row; a plugin's overlay lines are the plugin's, which a click in the viewport reaches as an event (`a_click_in_the_viewport_reaches_a_guest_that_asked_for_clicks_and_not_one_that_did_not`). The script clause was run: `open` of `des_bridge_root.ydr`, `workspace Model`, `click 660 470` and `click 700 600 alt`, through `just shots`, and the screens show Geometry 4 selected by the plain click and Model 0 by the Alt click (2026-10-20); no test holds the step since it needs a GPU adapter. +screen shows the model selected. Six hold in the tree, each seen failing first: Enter or Space on the focused Picked line opens the pick as a double click does, and its hint says so (`enter_on_the_focused_picked_line_opens_the_pick_as_a_double_click_does`; a screen reader's default action is still not one of them, since it arrives as a single click that the line must not act on); and a fragment's Outline lists a Bound row for the High physics level alone (`the_outline_lists_a_bound_row_for_the_physics_level_the_viewport_draws_and_no_other`, the Medium and Low summary lines staying). A click on a fragment's physics bound opens the Physics section that was closed over its row (`a_click_on_a_physics_bound_opens_the_section_that_holds_its_row`), and a double click on the Picked line queues the Outline's reveal, which `assert_opened_at` in `src/state/tests/a_pick_in_the_preview_opens_its_document_at_its_row.rs` fails without; `the_outline_selects` now holds the theme serial, which only a run in threads (`just test-lite`) could have shown. A click on a `.ybn` drawn as meshes picks the node whose mesh it meets, in the row its Outline gives it (`a_click_on_a_ybns_bounds_picks_the_node_it_draws`, seen failing first), and a click past it leaves the selection where it was, as in Wireframe. A click on a `.ynv`'s polygon selects its row in the Outline, which opens its section and draws it highlighted, and a click on the row selects it as well (`a_click_on_a_navmesh_polygon_selects_its_row_which_the_outline_opens_and_the_viewport_highlights`, each of the four seen failing with its part taken out). The remaining lines say they are not picked, and why: a cloth's edges and its collision composite draw for the cloth that is already the selected row and have no Outline row of their own to select; a particle effect's gizmo lines are drawn for the live particles of the running simulation, which move and have no row; a plugin's overlay lines are the plugin's, which a click in the viewport reaches as an event (`a_click_in_the_viewport_reaches_a_guest_that_asked_for_clicks_and_not_one_that_did_not`). The script clause was run: `open` of `des_bridge_root.ydr`, `workspace Model`, `click 660 470` and `click 700 600 alt`, through `just shots`, and the screens show Geometry 4 selected by the plain click and Model 0 by the Alt click (2026-10-20); no test holds the step since it needs a GPU adapter. ### R42k What drawing bones outside the Animation workspace leaves @@ -5104,8 +5104,8 @@ controls (170, 84 and 70, and two gaps of 6), `draw` clamps the bar to the viewp points and narrows only the level-of-detail box, so by a read of it, and not on a screen, in a viewport narrower than 352 points the Collision and Bones boxes lie past the bar's background and the viewport's edge, and `the_overlays_leave_the_axis_gizmo_clear_and_fit_a_narrow_viewport` in -`src/state/viewport_basics_for_inspecting_assets.rs` never draws the row; and `rigs` in -`src/state/a_skeleton_is_seen_without_an_animation.rs` records a corpus skip for each target and +`src/state/tests/viewport_basics_for_inspecting_assets.rs` never draws the row; and `rigs` in +`src/state/tests/a_skeleton_is_seen_without_an_animation.rs` records a corpus skip for each target and extension with no staged file holding a rest pose, which `OPENRAGE_REQUIRE_FIXTURES` turns into a failure, and no staged Enhanced `.ydr` holds one, so by a read of `skip_corpus`, and not run, the two tests that call `rigs`, @@ -5231,7 +5231,7 @@ manifest declares; the answer is kept in the preferences by plugin id and revoke Plugins, and a manifest that wants more is asked again. A patch passes the edit mode for the document's path and the format's read-back and canonical save, and each run's report carries the refusal's key, capability and sentence, also when the guest stopped after the refusal -(`HostError::StoppedAfterRefusal`). `src/state/a_plugin_asks_before_it_runs.rs` holds it with the +(`HostError::StoppedAfterRefusal`). `src/state/tests/a_plugin_asks_before_it_runs.rs` holds it with the sample guest, and `just self-check` draws the prompt and the page; [plugins/README.md](../../plugins/README.md#installing-a-plugin) says how to install one. Clicking Allow, Decline, Run plugin and Revoke in a live window is unchecked: the self-check draws, it does @@ -5308,7 +5308,7 @@ command or setting without rebuilding the host — per-file-type actions, a prov guest-side library. **Where it stands.** Four registries share one shape (format, title, panel, capability), two with -conformance tests (`src/state/adding_a_format.rs`, `crates/title/or-title/tests/adding_a_title.rs`), +conformance tests (`src/state/tests/adding_a_format.rs`, `crates/title/or-title/tests/adding_a_title.rs`), and OD-AUDIT-KEEPS keeps them. The plugin manifest is `crates/domain/or-plugin/src/manifest.rs`. The guest-side library is `plugins/guest`, on the ABI [R44c](#r44c-the-guest-abi) fixed, and `plugins/sample`, built from it for wasm32, runs under the host in @@ -5961,7 +5961,7 @@ progress in bytes and a Cancel that stops at its next write and removes the arch (`src/state/dlc_pack.rs`, `build_pack_with`); the app and the command share `dlc_pack_of_folder`, `dlc_refusals` and `create_dlc_pack`. A built pack's window shows the line, with Copy line and Open folder. `a_folder_packs_from_its_menu_into_the_pack_the_command_builds_of_it` -(`src/state/building_a_dlc_pack_from_the_app.rs`) packs a staged folder from its row's menu and +(`src/state/tests/building_a_dlc_pack_from_the_app.rs`) packs a staged folder from its row's menu and finds the archive byte-identical to the command's; it failed before the menu offered the command. Seen on `just shots` screens, not in a window. @@ -6219,7 +6219,7 @@ Folder for several, each under its own name, and a folder that already holds som Replace, Skip or Keep both. The edit gate is asked at the write, and where it would ask about the game as shipped the write is refused instead, as Export as…'s is. `a_drawable_converts_from_its_menu_and_its_report_equals_the_clis` -(`src/state/converting_from_the_app.rs`) converts a staged Legacy and an Enhanced `.ydr` from the +(`src/state/tests/converting_from_the_app.rs`) converts a staged Legacy and an Enhanced `.ydr` from the row's menu and finds the question's lines the words of the values the command reports, and the bytes written equal to the command's, for the same database; it failed before the menus offered Convert, and fails when the app converts without its database. Seen on `just shots` screens, not in @@ -6294,7 +6294,7 @@ fixed before its heading so that a window narrower than that narrows it (`questi `src/ui/panels/mod.rs`). The guess that a long texture name widened the question was wrong: the one label already wrapped at 760 points. What failed was that the rows after a wrap began under the file's line, and that a window narrower than 760 clipped the question at both edges. -`src/state/converting_is_listed_and_asked_inside_its_panel.rs` holds each. Five tests failed before the +`src/state/tests/converting_is_listed_and_asked_inside_its_panel.rs` holds each. Five tests failed before the fix: `a_gltf_exports_write_is_listed_as_an_export_and_cancel_export_reaches_it` and `an_export_as_write_is_listed_as_an_export_and_cancel_export_reaches_it` (both listed as "Extracting"), `the_palette_and_its_key_convert_the_open_document_with_no_row_selected` (the @@ -6315,8 +6315,8 @@ still says a whole folder converts with `openrage-cli convert retarget`, which n not a flag, and R59t's test for flags in the app's words passes it; and `ConvertClash` still repeats four fields of `ExtractClash` and shares only the question's text, because one struct would change the struct literals of three other files (`src/self_check/mod.rs`, -`src/state/settings_recents_and_small_editor_fixes.rs` and -`src/state/search_results_that_open.rs`). +`src/state/tests/settings_recents_and_small_editor_fixes.rs` and +`src/state/tests/search_results_that_open.rs`). **Done when.** A test lists a glTF export and an Export as… write in the jobs list and finds each named for what it is, and its Cancel stopping it; a test converts the open document from the palette @@ -6349,8 +6349,8 @@ assertion of `an_export_as_write_is_listed_as_an_export_and_cancel_export_reache `.filter(doing == doing).all(stopping)`, which passes on an empty set if the job leaves the list, though the find at its top shows the job was there; and `ConvertClash` repeats four fields of `ExtractClash` and shares only the question's text, one struct changing the struct literals of -`src/self_check/mod.rs`, `src/state/settings_recents_and_small_editor_fixes.rs` and -`src/state/search_results_that_open.rs`. The question's per-frame cost over a large selection is +`src/self_check/mod.rs`, `src/state/tests/settings_recents_and_small_editor_fixes.rs` and +`src/state/tests/search_results_that_open.rs`. The question's per-frame cost over a large selection is [R59f](#r59f-performance-and-cache-tuning)'s. **Done when.** A test starts a conversion's write while an export's runs and finds the toast naming @@ -6785,7 +6785,7 @@ bar. [↑ checklist](#phase-10--the-application) Done in #182. Settings ▸ Appearance picks a dark or light theme, an accent, an interface scale from -`SCALE_STEPS` and a font, and every window restyles at once. `src/state/prefs.rs` +`SCALE_STEPS` and a font, and every window restyles at once. `src/state/prefs/mod.rs` reads `appearance` field by field, so an unreadable value costs only itself. How it looks has not been checked by a human. @@ -6881,7 +6881,7 @@ textures; any other part at its own size), the simulation (the rules it runs fro particles, the snapshots a seek replays from, the pins), the HDRIs the sky loaded, and what Uses and Placed by read (the root archives' tables of the mount, the file catalogue and the placements). The session byte cache was counted already, in an archive document's `held_bytes`. A test in -`src/state/the_panel_counts_the_apps_cpu_state.rs` grows each line's structure through the app's own +`src/state/tests/the_panel_counts_the_apps_cpu_state.rs` grows each line's structure through the app's own API and holds its figure, down to the terms that dominate it: the name index's hash index, a nested archive and its parent's table, and the simulation's rules, particles and snapshots. Measured once, by a scratch test that is not kept, on the Legacy install with the game root open and a few heavy @@ -7251,7 +7251,7 @@ waits for the switch it asked for and is not opened when that is cancelled; the texture view's empty text name no extension; the install's heading reads "Game Install"; the catch-all error names a kind in words; the Search panel keeps room for its selected hit's path; and Copy path on a match inside archives copies its path in the archive. The recents, viewport, -question and game-folder cases are in `src/state/settings_recents_and_small_editor_fixes.rs`, the +question and game-folder cases are in `src/state/tests/settings_recents_and_small_editor_fixes.rs`, the rest beside their code, and each failed before its fix. Seen on `just shots` screens, not in a window. Found while closing it: the text editor's footer draws over its first line, its find bar sits at the window's corner over the menu bar, and in a narrow panel the texture view's header row @@ -7407,7 +7407,7 @@ editor's lines, as Go to Line was, and its rows wrap. The texture view's header their labels truncate rather than flow across rows, and each combo box gets a slot of its own size, since egui lays one out in what is left of a row; the view controls now follow the texture's details rather than the right edge. The viewport's overlay sizes its box from its text. Toasts stack left of -the job list while it is open. `src/state/nothing_draws_over_what_it_belongs_to.rs` draws each where +the job list while it is open. `src/state/tests/nothing_draws_over_what_it_belongs_to.rs` draws each where the default layout puts its panel on the default window and again as narrow as the Inspector's column at the smallest window, the toasts on both windows, and finds no two parts overlapping and none outside the panel; each test failed before its fix. Seen on `just shots` screens, not in a @@ -7508,7 +7508,7 @@ list open when the active document changes is closed, and so is a menu of the do (`close_lists_over_another_document`, which the level-of-detail list needed; a menu of the shell or of another document stays open since [R59z](#r59z-small-faults-left-in-the-default-views-menus-and-keys)), each document's Outline keeps a scroll offset of its own, and Go to File's rows cut the place short so the name -keeps one line. `src/state/small_faults_in_the_editor_and_the_previews.rs` holds +keeps one line. `src/state/tests/small_faults_in_the_editor_and_the_previews.rs` holds `the_find_bar_says_nothing_until_it_has_searched`, `the_find_bar_says_no_results_only_once_a_search_found_nothing`, `go_to_lines_field_stays_within_a_narrow_editor`, @@ -7593,7 +7593,7 @@ each toast saying what its stand-in did. self-check as a rebake does, and a script's `open` of a folder waits for its rows. **Where it stands.** Done. A test build's configuration is a folder `openrage-test-…` under the -temporary folder, which `src/state/test_scratch.rs` removes as the process exits, a failed test's +temporary folder, which `src/state/tests/test_scratch.rs` removes as the process exits, a failed test's included: a `TempDir` held in a static was never dropped, and nextest starts a process per test. `a_test_process_leaves_no_folder_in_the_temporary_folder_when_it_ends` runs two tests, one building the sample plugin guest, in a process whose temporary folder is its own and finds it empty after, @@ -7911,7 +7911,7 @@ between effects, a save before its write begins, and an overlay copy between chu cancel, so its worker runs on unheard. The defragment's and the overlay copy's progress windows, the status bar's extraction bar, bake and loading labels, and the bake's veil are gone; an extraction's clash question and a defragment's answer stay where they were. -`src/state/one_place_for_background_jobs.rs` starts one job of each kind, with a stand-in where a +`src/state/tests/one_place_for_background_jobs.rs` starts one job of each kind, with a stand-in where a real run needs an install or the network, finds each in the list, cancels each from it and finds each stopped, and finds nothing drawn over the window while the bake runs; both failed before the list existed. Seen on `just shots` screens, not in a window. @@ -7938,7 +7938,7 @@ it was opened from, so the export question offers those only for an entry never goes through the close request, and so does replacing the install from Settings ▸ Games' folder pick or Set active, or the Enhanced-open prompt's Switch, by `request_game_switch`. Exiting, New session and opening a project offer to save a project whose members changed. -`src/state/the_unsaved_marker_tells_the_truth.rs` makes each edit, detaches an edited dictionary and +`src/state/tests/the_unsaved_marker_tells_the_truth.rs` makes each edit, detaches an edited dictionary and switches the game; before the fix every edit on disk and every archive save left the tree marked, a loose save closed nothing, exiting dropped the project's change, a patch bypassed `mark_edited`, detaching and Switch dropped unsaved work, and Set active opened nothing. @@ -7971,7 +7971,7 @@ delete and a defragment ask `no_job_holds`, the same question, which extraction's rows sit in. A glTF export or import is not asked: its model is read before its worker starts, and an import reads the glTF it was handed once, whole; nor are a content search, the file index and the name scan, which read an install's archives for what they -list. `src/state/no_save_replaces_a_file_a_job_reads.rs` saves an archive while a conversion and a +list. `src/state/tests/no_save_replaces_a_file_a_job_reads.rs` saves an archive while a conversion and a comparison each read it, deletes and defragments one a conversion reads, and saves a file inside a folder a pack is built from by each of those routes; each is refused naming its job, and each failed before the fix. @@ -7999,7 +7999,7 @@ the read had made and the read running, and the next menu to ask reads the insta bounds ([R26c](#r26c-uses-reaches-every-pack)) included. Holding back only what the read has not read yet was not built: it opens nearly every archive through the mount until its last step, and nothing reports which it has passed. -`src/state/every_write_asks_the_jobs_reading_it.rs` holds each: the conversion, the export and the +`src/state/tests/every_write_asks_the_jobs_reading_it.rs` holds each: the conversion, the export and the texture beside it, the overlay save, the map's bounds read again, and every route to `file_replaced` (a tree's archive save, a loose file saved in place, an entry saved as a loose file, into the overlay and into an archive open on its own, a defragment, a rename, a move, a delete, an undo and a redo). @@ -8042,7 +8042,7 @@ through a `..`, or in another case where the disk ignores case, is the folder a `starts_with` compared spellings. The read of the install for Uses takes its turn: a mount cannot stop, so a read a save drops runs on unheard, and the next waits for it, while a read dropped before its turn does not begin; the placements and bounds reads stop at their next map or bound and are not -held. `src/state/every_write_into_a_folder_a_job_reads_is_refused.rs` holds each. Its one test that passed +held. `src/state/tests/every_write_into_a_folder_a_job_reads_is_refused.rs` holds each. Its one test that passed before the fix is the cut file sent to the Recycle Bin, a guard on a call that was already there; R60h's glTF sidecar test was seen failing with the sidecars' names left out of the paths asked about. Left: the jobs are asked before an extraction's or a conversion's Replace, Skip or Keep both, @@ -8073,7 +8073,7 @@ be seen waiting. **Where it stands.** Found while closing [R60i](#r60i-what-a-write-still-does-not-ask-after-r60h) (#572): a folder pasted, Ctrl dragged or dropped into a folder a job reads is refused file by file, but its directories are made first with no ask (`import_one` in `src/state/os_drop.rs`, -`rpf_add_folder_inner` in `src/state/rpf_tree.rs`), leaving empty folders in the folder a pack is +`rpf_add_folder_inner` in `src/state/rpf/rpf_tree.rs`), leaving empty folders in the folder a pack is built from and one message a file, and the test imports single files only; an extraction asks the jobs before its Replace, Skip or Keep both, so one into a folder where a job reads a file that already exists is refused though the user would answer Skip, as `write_conversion` does; the SWF, @@ -8092,7 +8092,7 @@ in another case; the case-spelling test is the disk's to answer, so hosted Linux negative check and the `..` spelling only, and it starts a pack build with `building` and never calls `ended` for `JobKind::DlcPack`; the guard in `poll_extract_job` that spares Uses a read after an extraction that skipped every item has no test; and the header of -`src/state/every_write_into_a_folder_a_job_reads_is_refused.rs` omits the drag and the cut paste it +`src/state/tests/every_write_into_a_folder_a_job_reads_is_refused.rs` omits the drag and the cut paste it covers. The cost of `no_job_touches` on the UI thread is [R59f](#r59f-performance-and-cache-tuning)'s. @@ -8662,7 +8662,7 @@ every documented CLI command reports the same values. **Where it stands.** Done (P39 to P60, #286 to #329), and both crates are deleted (R66f). The app holds one resource payload, `DocPayload::Resource(or_io::Asset)`, for every format `FORMATS` lists at every target it ships, and authors each blank from `Default` through its `PayloadHandler`; -`every_declared_format_opens_with_no_pack` (`src/state/authoring.rs`) makes, opens, saves and +`every_declared_format_opens_with_no_pack` (`src/state/tests/authoring.rs`) makes, opens, saves and reopens a blank and the smallest staged file for each, and `every_enhanced_row_opens_and_saves_with_no_pack` holds the Enhanced rows. The viewport walks the owned drawable (`drawable_meshes` in `src/render/meshes.rs`) and bound @@ -9115,15 +9115,15 @@ says one (`FileDevice::open_head`, `read_prefix`, `levels`, `edit_bone`, `BoneAddress`, `rebuild_rest_pose`, `keep_prefs_in`, `reads_typed_text`, `named` and `MAX_ELEMENTS`), the ⚠ paragraphs among them stating real constraints; and comments narrate the next block, as in `src/ui/timeline/the_marks_of_the_timeline_read_at_3_to_1_on_their_rows.rs`, -`src/state/the_skeleton_files_own_model_can_be_hidden.rs` and -`src/state/a_skeleton_is_seen_without_an_animation.rs`, where three say what the assertion under +`src/state/tests/the_skeleton_files_own_model_can_be_hidden.rs` and +`src/state/tests/a_skeleton_is_seen_without_an_animation.rs`, where three say what the assertion under them checks. `every_rs_file_in_src_is_declared_by_a_module` reads a `mod` only at column 0 and rejects `pub(in path) mod x;`; its `#[path]` branch and the main, cli_main and mod rule for a module's directory are exercised by no test, it passed on its first run and was never seen failing, and the `#[path]` module that `src/render/meshes.rs` declared into `or-interchange`'s baseline (now `crates/foundation/or-test-support/src/baseline.rs`) left that directory unjudged; -`src/repo_tests/doc_counts.rs` and `src/state/tests.rs` read `src/state/mod.rs` as text, so another move out of +`src/repo_tests/doc_counts.rs` and `src/state/tests/mod.rs` read `src/state/mod.rs` as text, so another move out of it can break them as `every_confirmable_action_can_be_applied` was broken; `no_file_in_src_exceeds_the_code_line_gate` asserts only a count over the gate, so no test failed before the move that gave `src/state/mod.rs` its room, which the ignored @@ -9854,7 +9854,7 @@ on both installs by `the_layers_of_a_real_install_at_three_places`. *The screen.* The Layers section switches each layer with its radius and its count at the camera, with three presets; the items are painted over the frame, coloured by category with a legend; with no layer on nothing is asked; a click on an item takes it before what stands behind -(`src/state/the_world_screen_shows_layers.rs`). `openrage-cli world layers` asks the same. +(`src/state/tests/the_world_screen_shows_layers.rs`). `openrage-cli world layers` asks the same. Left: the items tested against the depth of the world; scenario points, whose region no test here could build by hand; rooms and portals; the levels of detail; sound zones and emitters; collision @@ -9935,7 +9935,7 @@ synthetic packs). A session holds the sources as typed roots and writes them onc inverse states the digest or the session token it applies to, or is refused (`a_session_of_map_edits_writes_once_what_each_edit_writes`). The Map screen holds a session for each pack it edits, written when the project is saved -(`src/state/the_map_screen_holds_a_session.rs`; +(`src/state/tests/the_map_screen_holds_a_session.rs`; [on screen](Workbench_UX_Design.md#what-the-map-screen-builds), [timings](../reference/Crate_Reference.md#domain-crates)). And a map, a built entity, a type file and a base archetype made @@ -10788,7 +10788,7 @@ scan of every row, and an interior's refusal kept for the world's life. children are loaded; the kit fails by a rule's name on a fake built to break that rule; a key a fake adapter returns that no catalog holds fails the language gate; a line that names a game in a core module outside the ledger fails the architecture test; and the GTA V forest's suites and the tests -of `crates/domain/or-world-gta6/src/stream_tests.rs` pass with no body changed. +of `crates/domain/or-world-gta6/src/stream/tests.rs` pass with no body changed. ### R71b The GTA VI world behind the contract @@ -11036,7 +11036,7 @@ none of: the driver streams it from the session alone (`a_sessions_own_map_streams_inside_its_box_alone_is_named_and_goes_when_let_go`, on the fake title and on GTA V, whose store adds an object to such a map). -*GTA VI's placement and removal.* `crates/domain/or-world-gta6/src/edit.rs` stands, turns and +*GTA VI's placement and removal.* `crates/domain/or-world-gta6/src/edit/mod.rs` stands, turns and scales an entity in the tree a map's body reads to and gives back what undoes it (`a_placement_stands_the_entity_grows_the_extents_and_its_undo_gives_the_tree_back`). Its `entities` copies, adds and removes over the sections of a body and of the maps that name it, @@ -11082,7 +11082,7 @@ passing through what the world names none for. *The edits.* The Selection section moves, turns, scales and deletes what is picked through [R71i](#r71i-one-edit-stack-for-every-title)'s store, one step of the Map screen's Undo each -(`src/state/the_world_screen_edits_a_project.rs`), and several fields typed before one Enter are +(`src/state/tests/the_world_screen_edits_a_project.rs`), and several fields typed before one Enter are one step (`a_place_and_a_scale_typed_before_one_enter_are_one_step_of_undo_that_holds_both`). *The manipulator.* `or_world::gizmo`: a drag is one edit @@ -11121,8 +11121,8 @@ rows in place of the Map screen's store, with the two files this row deletes. **Done when.** On the fake title a click returns the node under the pixel, a drag applies one operation to its edit session, the next selection draws the node moved, and Undo takes it back, in real frames with no window; a tool whose capability a title lacks is greyed and says why; the plan -overlay of a GTA VI archive draws the same shots as before; and `src/state/gta6_world.rs` and -`src/state/gta6_world_fill.rs` are gone. +overlay of a GTA VI archive draws the same shots as before; and `src/state/gta6/world/gta6_world/mod.rs` and +`src/state/gta6/world/gta6_world/fill.rs` are gone. ### R71k Red Dead Redemption 2 diff --git a/docs/direction/Shaded_World_Plan.md b/docs/direction/Shaded_World_Plan.md index bc6fd07e1..7afee8861 100644 --- a/docs/direction/Shaded_World_Plan.md +++ b/docs/direction/Shaded_World_Plan.md @@ -105,8 +105,8 @@ One test replaces the lint that read one extension. It finds every shader module | What | Where | Row | |---|---|---| | The GTA V world's invented look: sun, ambient, exposure, the tint that stands for ambient, gradient sky, sun disc, far-light sprites, level water of one colour, glow by lists of names | `src/render/viewport/world_plain.rs`, the renderer's plain sky, the look of `crates/domain/or-world-gta5/src/streaming/install.rs`, the sky module of `or-world-gta5`, the glow lists of `crates/domain/or-world-gta5/src/archetypes/models.rs`, the sky's and the frame's facts of `crates/domain/or-world/src/model.rs` | R74a | -| GTA VI's hand port: the families, G-buffer, cast, glow and blended stages of `WORLD_SHADER`, its water, far stand-ins and their bake, terrain shadow, sky table, stars and discs, temporal pass, meter, grade, bloom, sharpen, room masks, lamps, and the arithmetic that feeds only them | `crates/runtime/or-renderer/src/world/`; the viewport's post chain with its shaders and maths, and its meter; the sky table, the stars and discs, the grade and the room masks of `crates/runtime/or-renderer/src/game_shaders/`; the app's world material bridge; the feeders of `src/state/gta6_worldview/` nothing else reads | R74a | -| GTA VI's day turned into GTA V's variables, and the GTA VI world's use of a GTA V pack | `frame_keyframe` of `crates/io/or-io/src/gta6/timecycle.rs`, the eight-shell fit of the light law of `or-world-gta6` | R74a | +| GTA VI's hand port: the families, G-buffer, cast, glow and blended stages of `WORLD_SHADER`, its water, far stand-ins and their bake, terrain shadow, sky table, stars and discs, temporal pass, meter, grade, bloom, sharpen, room masks, lamps, and the arithmetic that feeds only them | `crates/runtime/or-renderer/src/world/`; the viewport's post chain with its shaders and maths, and its meter; the sky table, the stars and discs, the grade and the room masks of `crates/runtime/or-renderer/src/game_shaders/`; the app's world material bridge; the feeders of `src/state/gta6/world/gta6_world/worldview/` nothing else reads | R74a | +| GTA VI's day turned into GTA V's variables, and the GTA VI world's use of a GTA V pack | `frame_keyframe` of `crates/io/or-io/src/gta6/timecycle/mod.rs`, the eight-shell fit of the light law of `or-world-gta6` | R74a | | The pick's multiplier inside surface shading | the instance record's picked flag and the tint the world's program multiplied by | R74a | | Code no frame reaches | the renderer's stencil module, the unused arithmetic of the world's light maths | R74a | | The world's packed vertex and the viewport's expanded buffers | the world's vertex of three attributes in `crates/runtime/or-renderer/src/world/pipelines.rs`, the buffers of `crates/runtime/or-renderer/src/game_shaders/geometry/mesh/scene.rs` | R74c | diff --git a/docs/direction/Unified_World_Plan.md b/docs/direction/Unified_World_Plan.md index cfbebcc20..45fd65454 100644 --- a/docs/direction/Unified_World_Plan.md +++ b/docs/direction/Unified_World_Plan.md @@ -26,10 +26,10 @@ Read at `9fdf0fee`, before any row was built; R71a added the core's modules besi The app holds two GTA VI worlds, each a process-wide singleton with its own index and kept file: the World screen, which streams and draws an install, and the Map screen, which edits a scanned map body as a document. -At `9fdf0fee` the World screen's viewer is `src/state/gta6_worldview/` (55 files, 18,010 lines, 189 tests); the bridge that draws it, which is the host today, is the world files of `src/render/viewport/` (13 files, 4,651 lines); the Map screen's world store is `src/state/gta6_world.rs` with `src/state/gta6_world_fill.rs`; and map edits are steps of a document's undo, in `src/state/gta6_map.rs` and its neighbours. +At `9fdf0fee` the World screen's viewer is `src/state/gta6/world/gta6_world/worldview/` (55 files, 18,010 lines, 189 tests); the bridge that draws it, which is the host today, is the world files of `src/render/viewport/` (13 files, 4,651 lines); the Map screen's world store is `src/state/gta6/world/gta6_world/mod.rs` with `src/state/gta6/world/gta6_world/fill.rs`; and map edits are steps of a document's undo, in `src/state/gta6/world/gta6_map/mod.rs` and its neighbours. -- **The viewer is one static.** `viewer()` in `src/state/gta6_worldview/mod.rs` locks a `LazyLock>`, and at `9fdf0fee` 23 call sites reach it, 10 of them in `src/self_check/shots/world.rs`. -- **The map index and the stream path have no test over an archive**; two tests of `src/state/gta6_worldview/texture_tests.rs` do write a resource with `write_rpf9_resource`, scan it in a scratch install and read a texture back. +- **The viewer is one static.** `viewer()` in `src/state/gta6/world/gta6_world/worldview/mod.rs` locks a `LazyLock>`, and at `9fdf0fee` 23 call sites reach it, 10 of them in `src/self_check/shots/world.rs`. +- **The map index and the stream path have no test over an archive**; two tests of `src/state/gta6/world/gta6_world/worldview/texture/tests.rs` do write a resource with `write_rpf9_resource`, scan it in a scratch install and read a texture back. - **The selection carries no identity**: an instance names no node, map or entity, and nothing picks, selects or moves in the World screen. - **Three readers of a body by member hash live in the app**: `src/state/gta6_worldview/index_types.rs`, `src/state/gta6_worldview/lights_lod.rs` and `src/state/gta6_worldview/lights_index.rs`. - **The index is whole-install tables**, several derived across archives, which `src/state/gta6_worldview/index_keep.rs` writes whole under a head that also holds a word of `fresh_game.json`, a file a person writes beside the index. @@ -72,14 +72,14 @@ Each row is a duplicate the programme ends, at `9fdf0fee`: | What | GTA V | GTA VI | |---|---|---| -| The index of an install | `crates/domain/or-world-gta5/src/streaming/world_index/mod.rs` | `src/state/gta6_worldview/index.rs` and five neighbours | -| A kept file of rows, checked against the archives' size and time | `crates/domain/or-world-gta5/src/streaming/world_index/kept.rs` | `src/state/gta6_worldview/index_keep.rs`, and a second in `src/state/gta6_world_fill.rs` | +| The index of an install | `crates/domain/or-world-gta5/src/streaming/world_index/mod.rs` | `src/state/gta6/world/gta6_world/worldview/index.rs` and five neighbours | +| A kept file of rows, checked against the archives' size and time | `crates/domain/or-world-gta5/src/streaming/world_index/kept.rs` | `src/state/gta6_worldview/index_keep.rs`, and a second in `src/state/gta6/world/gta6_world/fill.rs` | | The driver around the forest, which both share (`Forest` of `crates/domain/or-world/src/streaming.rs`): wanted maps, read, insert, select, instances | `crates/domain/or-world-gta5/src/streaming/world_forest/mod.rs` | `src/state/gta6_worldview/stream.rs` and its neighbours | | What is switched on at an hour | `crates/domain/or-world-gta5/src/streaming/state.rs` | `src/state/gta6_worldview/index_states.rs` | | A map's extents grown to hold an entity | `crates/domain/or-maps/src/edit.rs`, `crates/domain/or-world-gta5/src/map/extents.rs` | `src/state/gta6_map_extents.rs` | -| Removing an entity and repairing links across maps | `crates/domain/or-world-gta5/src/authoring/execute.rs`, `crates/domain/or-maps/src/delete.rs` | `crates/io/or-io/src/gta6/map_grow.rs`, `src/state/gta6_map_entity.rs` | +| Removing an entity and repairing links across maps | `crates/domain/or-world-gta5/src/authoring/execute.rs`, `crates/domain/or-maps/src/delete.rs` | `crates/io/or-io/src/gta6/map/grow/mod.rs`, `src/state/gta6/world/gta6_map/entity.rs` | | The undo of the Map screen | `src/state/workbench/maps.rs` | the document's own steps | -| The box scene of the Map screen | `crates/domain/or-maps/src/scene.rs` | `src/state/gta6_map.rs` | +| The box scene of the Map screen | `crates/domain/or-maps/src/scene.rs` | `src/state/gta6/world/gta6_map/mod.rs` | | A map body read for its nodes, its occluders and its lights | one read, of `crates/domain/or-world-gta5/src/map/map_data.rs` | three loops with three pools: the forest's, the occluders' and the lights' | ## The shape @@ -275,7 +275,7 @@ GTA V states a vertex buffer laid out by the vertex stage's inputs, a material a A dome and light volumes are a kept mesh and a list, which a kind states. The frame holds no pass that is a step of no kind: the measure of 2026-11-27 counted five such, the exposure's meter and the World screen's shadow cast by tile, rooms' lamps, terrain shadow and history, and all five are deleted ([ruling 5](#asked-of-the-owner)). -The translators stay tools: the profile names its translator and the app hands the host one for each name, as `src/state/gta6_shader_translator.rs` and the helper process of `src/state/game_pack/mod.rs` do today. +The translators stay tools: the profile names its translator and the app hands the host one for each name, as `src/state/gta6/drawable/gta6_shaders/translator.rs` and the helper process of `src/state/game_pack/mod.rs` do today. ### The fallback @@ -388,19 +388,19 @@ Read [the contract](#the-contract) with `crates/domain/or-world/src/fake.rs`, an ### The GTA VI world behind the contract (R71b) -Read [GTA_VI_World_Viewer.md](../features/GTA_VI_World_Viewer.md), `src/state/gta6_worldview/mod.rs`, `select_asking` in `src/state/gta6_worldview/stream.rs`, `src/state/gta6_worldview/model.rs` with `meshes_at` of `src/render/gta6_drawable/mod.rs`, `src/self_check/shots/compare.rs`, and the shots steps of [Development_Workflow.md](../guides/Development_Workflow.md#screenshots). +Read [GTA_VI_World_Viewer.md](../features/GTA_VI_World_Viewer.md), `src/state/gta6/world/gta6_world/worldview/mod.rs`, `select_asking` in `src/state/gta6_worldview/stream.rs`, `src/state/gta6/world/gta6_world/worldview/model/mod.rs` with `meshes_at` of `src/render/gta6_drawable/mod.rs`, `src/self_check/shots/compare.rs`, and the shots steps of [Development_Workflow.md](../guides/Development_Workflow.md#screenshots). It lands in five parts, each on its own check: 1. **The reference, made able to fail.** A World shots script at fixed cameras, hours and modes, with `world settle`, `world converge`, a shot and a `world dump` at each; a comparison in which a missing reference fails and the share of pixels past 16 levels is bounded beside the mean; dumps compared over a stated list of fields; and an install-gated suite of digests of models, textures, the index's rows and the look's frame values, on the unchanged code. References live where [ruling 12](#asked-of-the-owner) says. It ends when an altered reference and an altered digest each fail, and is under way in a lane of its own. -2. **The closed move.** By the closure of imports at `9fdf0fee`, 13 files can leave the app before the selecting half. Seven change in imports alone: the reader pool, to the core, its workers keeping their open files in the core's `Worker`; `src/state/gta6_worldview/index_types.rs`, `src/state/gta6_worldview/lights_lod.rs` and `src/state/gta6_worldview/lights_index.rs`, to `or-io`; the lights' law and variables and the material, to the adapter. Six follow after two cuts: the index with its kept file, mount binding, scan and states, and the occluders. The cuts: the block of `src/state/gta6_worldview/index.rs` that implements a method of the app's `Viewer` (`land_and_water`) stays in the app, and the mount binding takes the configuration folder and the keys from the `Opening`. The adapter's title, its registry line and the slow tier's keys land here. +2. **The closed move.** By the closure of imports at `9fdf0fee`, 13 files can leave the app before the selecting half. Seven change in imports alone: the reader pool, to the core, its workers keeping their open files in the core's `Worker`; `src/state/gta6_worldview/index_types.rs`, `src/state/gta6_worldview/lights_lod.rs` and `src/state/gta6_worldview/lights_index.rs`, to `or-io`; the lights' law and variables and the material, to the adapter. Six follow after two cuts: the index with its kept file, mount binding, scan and states, and the occluders. The cuts: the block of `src/state/gta6/world/gta6_world/worldview/index.rs` that implements a method of the app's `Viewer` (`land_and_water`) stays in the app, and the mount binding takes the configuration folder and the keys from the `Opening`. The adapter's title, its registry line and the slow tier's keys land here. 3. **The kept file.** The index goes onto the core's mechanism: rows for each archive with names unresolved, its tables derived across archives in the one section `whole` writes, and a `link` that makes the ids and leaves GTA VI's own tables on the index for its readers. `fresh_game.json` is one of the other inputs, with its stamp. The first open deletes the old kept file of that install, moves `fresh_game.json` from its old place and shows the rebuild's progress, whose time is recorded: a change of the rules' version costs every user that rebuild. -4. **The selecting half.** The two symbols it takes from the renderer move below it; then `src/state/gta6_worldview/stream.rs` with its five child modules, the interiors and the room walk move, the block of `src/state/gta6_worldview/stream_grass.rs` on `Viewer` staying in the app. The world thread is rewritten around the core's `Driver` and enters the core with the pool: `want` on the thread, the reads in the pool, `give`, `settle`, and the interiors it waits for read from the placing body and given back. Of `select_asking` the mechanics every title shares are the driver's already; GTA VI's rules (held codes, time archetypes, batch levels that hide a parent's instances, cards that hand off to trees, the walk that marks an instance as casting only) go to its rows' gates, its body's `draws` and `lay`, and its policy. The occluders and the lights leave their own loops and pools for the one read of a body. `crates/domain/or-world/src/streaming_rules.rs` moves to the adapter but for the two functions the forest calls. -5. **The outputs.** The 18 other files. The model reader returns the core's `Model`: the vertex decode of `src/render/gta6_drawable/mod.rs` goes below the app, and `meshes_at` stays, calling down, with its skinning. The texture reader answers batched asks, and `src/state/gta6_texture_index.rs` goes with it. The sky, wind, water and terrain files return frame facts and feed the rest by name; their blocks on `Viewer` stay in the app. The kit's test file lands here, its rule on models needing this reader. +4. **The selecting half.** The two symbols it takes from the renderer move below it; then `src/state/gta6_worldview/stream.rs` with its five child modules, the interiors and the room walk move, the block of `src/state/gta6/world/gta6_world/worldview/grass.rs` on `Viewer` staying in the app. The world thread is rewritten around the core's `Driver` and enters the core with the pool: `want` on the thread, the reads in the pool, `give`, `settle`, and the interiors it waits for read from the placing body and given back. Of `select_asking` the mechanics every title shares are the driver's already; GTA VI's rules (held codes, time archetypes, batch levels that hide a parent's instances, cards that hand off to trees, the walk that marks an instance as casting only) go to its rows' gates, its body's `draws` and `lay`, and its policy. The occluders and the lights leave their own loops and pools for the one read of a body. `crates/domain/or-world/src/streaming_rules.rs` moves to the adapter but for the two functions the forest calls. +5. **The outputs.** The 18 other files. The model reader returns the core's `Model`: the vertex decode of `src/render/gta6_drawable/mod.rs` goes below the app, and `meshes_at` stays, calling down, with its skinning. The texture reader answers batched asks, and `src/state/gta6/textures/gta6_texture_index.rs` goes with it. The sky, wind, water and terrain files return frame facts and feed the rest by name; their blocks on `Viewer` stay in the app. The kit's test file lands here, its rule on models needing this reader. - **Deletes.** `src/state/gta6_worldview/index_keep.rs`; the GTA VI streamer's own loop around the forest; the occluders' and the lights' loops and pools; the block that opens an archive for a worker, written once in place of six times. -- **Check.** After each part the shots, dumps and digests of part 1 match, with no candidate line. No test of the viewer is deleted, and the pull request lists each restated. After part 3 a second start opens no archive and an edit of `fresh_game.json` rebuilds. After part 4 one caller of the forest's `select` is left outside tests. After part 5 [the kit](#what-an-adapter-writes-to-pass-the-kit) passes over a world built by hand, as the viewer's tests build rows and bodies. The tests of `src/state/gta6_edit_tests.rs` and the Map screen's pass with no body changed. -- **Must not touch.** What the picture is: no family, pass or constant changes. What the Map screen and the model viewport do, beyond the viewer's declaration in `src/state/gta6_world.rs` and the vertex decode part 5 moves. The singleton, which stays in the app as a shell over the crate until R71c. +- **Check.** After each part the shots, dumps and digests of part 1 match, with no candidate line. No test of the viewer is deleted, and the pull request lists each restated. After part 3 a second start opens no archive and an edit of `fresh_game.json` rebuilds. After part 4 one caller of the forest's `select` is left outside tests. After part 5 [the kit](#what-an-adapter-writes-to-pass-the-kit) passes over a world built by hand, as the viewer's tests build rows and bodies. The tests of `src/state/gta6/drawable/gta6_edit/tests.rs` and the Map screen's pass with no body changed. +- **Must not touch.** What the picture is: no family, pass or constant changes. What the Map screen and the model viewport do, beyond the viewer's declaration in `src/state/gta6/world/gta6_world/mod.rs` and the vertex decode part 5 moves. The singleton, which stays in the app as a shell over the crate until R71c. - **Measured in part 1.** Two runs of the script agree in every digest and every compared dump field and not in the far band of their shots, which follows what the device holds: the digests and the dumps are the exact check, and each shot has bounds of its own ([the reference](../guides/Development_Workflow.md#the-reference-of-the-gta-vi-world-screen)). - **Not known.** Whether the core's driver serves GTA VI's chunks, swaps and bands without a second driver, which part 4 answers by deleting its own, and what its scan of every row costs there. Whether `or-io` can write a map body with its registration documents for the kit's second tier. @@ -466,7 +466,7 @@ Read [Shader_Definition_Database.md](../features/Shader_Definition_Database.md) ### The programs of GTA VI over a world (R71h) -Read [what a build's programs come to](../features/GTA_VI_Builds.md#what-a-builds-programs-come-to), [what the graphics library cannot run](#what-the-graphics-library-cannot-run), `crates/runtime/or-renderer/src/game_shaders/geometry/meshlets.rs`, `src/render/gta6_meshlets.rs` and `src/state/gta6_shaders.rs`. +Read [what a build's programs come to](../features/GTA_VI_Builds.md#what-a-builds-programs-come-to), [what the graphics library cannot run](#what-the-graphics-library-cannot-run), `crates/runtime/or-renderer/src/game_shaders/geometry/meshlets.rs`, `src/render/gta6_meshlets.rs` and `src/state/gta6/drawable/gta6_shaders/mod.rs`. - **Builds.** GTA VI's profile: its targets and steps; its surface pass over the host's pages as storage buffers; a transform for each instance, which nothing feeds today; the bindings only the game fills, named; the buffer fitting Metal needs, applied where the app builds a pass; and an encoder its fallback surfaces write its targets with, where today such a surface is drawn after the resolve. Then its lighting: by its own programs if the bindings the game fills can be named, and by named passes if not, which the measure makes the likelier. - **Deletes.** A family of the fallback's shader once every supported backend draws every material that used it; the renderer's mapping of a material onto a family with the last of them. @@ -476,7 +476,7 @@ Read [what a build's programs come to](../features/GTA_VI_Builds.md#what-a-build ### One edit stack (R71i) -Read `crates/domain/or-maps/src/operation.rs` with its session, the two other vocabularies named in [GTA V](#gta-v), `crates/domain/or-maps/src/changes.rs`, `src/state/workbench/maps.rs`, and the three GTA VI entity edit files of `src/state/` with `crates/io/or-io/src/gta6/map_grow.rs`. +Read `crates/domain/or-maps/src/operation.rs` with its session, the two other vocabularies named in [GTA V](#gta-v), `crates/domain/or-maps/src/changes.rs`, `src/state/workbench/maps.rs`, and the three GTA VI entity edit files of `src/state/` with `crates/io/or-io/src/gta6/map/grow/mod.rs`. - **Builds.** In the core, beside the envelope, the guard and the session R71a built: the envelope's ordering rules; the trait of who keeps the steps; and the skeleton of comparison, put-back and merge over a trait that gives an entity's identity, which [ruling 16](#asked-of-the-owner) bears on. GTA V's store stays `or-maps`: its session behind the edit session's trait, answering a changed body to the driver, its steps kept by the project's History. GTA VI's operations are new, in its adapter, as pure functions over the sections of a body: place, move, turn, scale, retype, add and remove across linked bodies, each with its inverse, guarded by a digest of that body. The app's document owns GTA VI's bytes, keeps its steps and lends the body to those functions ([ruling 14](#asked-of-the-owner)). One apply verb on the command line for any title's operations. - **Deletes.** The three GTA VI entity edit files of `src/state/`, `src/state/gta6_map_extents.rs`, the second history of the Map screen, and the verbs [the command line](#the-command-line) turns into refusals. @@ -489,7 +489,7 @@ Read `crates/domain/or-maps/src/operation.rs` with its session, the two other vo Read [World_Editor_UX_Design.md](World_Editor_UX_Design.md), `crates/domain/or-world/src/gizmo.rs`, `src/render/viewport/pick.rs` and `src/ui/commands/target.rs`. - **Builds.** The surface the screen rows of R70 stand on, for every title: the pick by an id pass, the selection outline and the manipulator in the overlay pass, the registry of layers and of panel sections, a command's capability in the command table, and placement rows as a capability. GTA VI's placement rows replace the Map screen's world store and its kept file. -- **Deletes.** `src/state/gta6_world.rs` and `src/state/gta6_world_fill.rs`. +- **Deletes.** `src/state/gta6/world/gta6_world/mod.rs` and `src/state/gta6/world/gta6_world/fill.rs`. - **Check.** On the fake title a click returns the node under the pixel, a drag applies one operation to its edit session, the next selection draws the node moved through the session's body, and Undo takes it back, in real frames with no window. A tool whose capability a title lacks is greyed and says why. The plan overlay of a GTA VI archive draws the same shots as before. - **Must not touch.** What each tool does for a mapper, which the rows of R70 own. diff --git a/docs/direction/Workbench_Plan.md b/docs/direction/Workbench_Plan.md index 7946437cf..9220bec0c 100644 --- a/docs/direction/Workbench_Plan.md +++ b/docs/direction/Workbench_Plan.md @@ -167,7 +167,7 @@ Does not do: the clothing model (wave F), anything in the app. ### Wave C: the project container -Read [Project_Model_Design.md](Project_Model_Design.md) in full, the project file code in `src/state/project/mod.rs` and the project cases in `src/state/the_front_door.rs`. +Read [Project_Model_Design.md](Project_Model_Design.md) in full, the project file code in `src/state/project/mod.rs` and the project cases in `src/state/tests/the_front_door.rs`. Build, in a new domain crate (the working name is or-project), so that the app and the CLI share it: @@ -225,7 +225,7 @@ Read [Workbench_UX_Design.md](Workbench_UX_Design.md) (the flows and the start p Build the start page's four buttons and its recent-project cards with their content badges and build state, the first-launch goal cards for the content that exists, the New project dialog with the templates that exist (Empty project, Files, and Adopt a folder, which is named Project from a folder on screen), reopening the last project at launch with a setting and a way to the start page, the recent-project menu in the status bar, the palette entries, the Not found handling with Locate and Remove, the Make this a project banner on Open folder, and Open in new window as a second process. -Checks: a launch with a remembered project reopens it on its workspace; a launch without one opens the remembered install as the cases in `src/state/the_front_door.rs` require; closing a project shows the start page; a missing project shows Not found; before and after screens in the pull request. +Checks: a launch with a remembered project reopens it on its workspace; a launch without one opens the remembered install as the cases in `src/state/tests/the_front_door.rs` require; closing a project shows the start page; a missing project shows Not found; before and after screens in the pull request. ### Wave F: the Wardrobe engine diff --git a/docs/direction/Workbench_UX_Design.md b/docs/direction/Workbench_UX_Design.md index ccd71e277..225c75f40 100644 --- a/docs/direction/Workbench_UX_Design.md +++ b/docs/direction/Workbench_UX_Design.md @@ -274,7 +274,7 @@ Wave H of [Workbench_Plan.md](Workbench_Plan.md) built the Wardrobe workspace, t - **Picking, keys, search, tags and pictures.** Wave P21 made the list something to work in. A click picks a garment, Ctrl and a click puts one in or out of the pick, Shift and a click picks everything from the garment clicked first to it in the order the list shows, and a click on a heading picks every garment under it; the garment selected is the last one picked, and nothing is picked while nothing is selected, so a pick left over from a removal does nothing, and a filter, a ped or a query that hides garments picked earlier lets them go, so that what is picked is always what the list shows (`a_filter_lets_go_of_the_garments_picked_that_it_hides_and_the_panel_counts_what_the_list_shows`, `shift_and_ctrl_pick_several_garments_a_heading_picks_its_own_and_delete_takes_them_out_as_one_step`). Delete removes the garments picked as one step of Undo and F2 puts the keyboard in the name of the one picked: both are the registry's commands, which read the garments picked through `Target::Garments` while the list is the panel last clicked, so they are in the palette and the key dispatcher takes them as it takes the Files view's. With several garments selected the Garment panel says how many (`3 garments selected`) and offers only what is set on all of them as one step: their ped and slot, their tags and their group; the name, position, files and textures wait for one garment. While the pointer is over the list and no text is being typed, Up and Down walk it, Shift with either spans, Enter opens the model of the garment in the Model workspace and Space looks at the garment (`the_arrow_keys_walk_the_list_enter_opens_the_model_and_f2_names_the_garment`); the keys are read before the header is drawn, so an Enter that ends a word typed in the filter opens nothing. The quick look is the Assets table's: the same Space command and the same `Glance`, docked under the list and never over it, with the texture the preview wears decoded at the smallest mip that is still 192 points wide, and the garment's game name, place, group, tags and problems; Space, Escape and its button close it (`space_looks_at_the_garment_without_opening_it_and_shows_its_texture`). The filter is fuzzy: each word of the query must match, as letters in order, one of the words a garment is found by, which are its place, slot, name, the name the game gives its model, group, tags and ped (`or_wardrobe::search::terms`), against one word at a time because letters in order across one long line match nearly anything (`a_fuzzy_query_finds_a_garment_by_a_fragment_of_its_game_name_its_slot_or_what_it_is_called`). Tags and a group are the creator's own words, kept in `wardrobe.json` where somebody wrote them and never read by a build (`tags_and_a_group_are_set_over_a_list_all_or_none_and_a_pack_without_them_writes_none`, `a_build_is_the_same_with_tags_and_a_group_as_without`, `tags_and_a_group_are_set_on_every_garment_picked_with_one_undo_and_a_search_finds_them`). Each row draws the picture of its first texture, and resting on it shows every texture of the garment; a picture is decoded once, at the smallest mip that is still 64 points wide, on the worker of the dressed ped six at a time so that the ped is not kept waiting, and again only when its file changes (`a_garments_texture_is_decoded_once_for_its_row_and_hovering_the_row_shows_its_textures`). A row's menu names what it copies and shows (`a_rows_menu_copies_its_name_game_name_and_path_and_shows_its_file_in_the_file_manager`). - **What a drop takes in.** Wave P22 widens what Add clothes… and a drop on the Wardrobe read. A picture named as a texture (a PNG, and a TGA, BMP, JPEG, TIFF, PSD or DDS) is made into a textures source of its variation, compiled once in a scratch folder before it is kept, with no convert button: a DDS is copied block for block, a picture of floating-point light (EXR or HDR) with no rule to bring it down is left out with the compile's sentence, and a picture whose name says no texture of a garment is left out and not given to the only model, since a `.ytd` that states no place goes with the only model and a picture could be anything (`a_dropped_image_becomes_an_authored_textures_source_of_its_garment_in_every_format_and_undo_takes_it_out`, `light_with_no_rule_to_bring_it_down_is_left_out_by_name_with_the_compile_s_sentence_and_no_source`). A `.ytd` and a picture, or two pictures, whose names state one variation of a garment are one texture: the `.ytd` is kept, else the first picture, and each other picture is left out by name with the file that holds the variation, so a folder that keeps a picture beside each texture under its name does not double its textures (`a_ytd_and_the_picture_beside_it_under_its_name_are_one_texture_whichever_sorts_first`, `two_pictures_of_one_variation_are_one_texture_and_the_first_is_kept`). A name behind the `dlc^` streaming prefix is read as the name after it, with the collection before that (`a_dlc_streaming_prefix_is_read_through_and_the_name_after_it_states_the_garment`), and a file that opens with `FXAP`, a protected asset and no RSC7 resource, is left out by its name with that reason, in a drop and in an import (`a_protected_file_in_a_drop_is_named_in_the_left_out_list_with_its_reason`). A garment is the one the pack holds when its ped, its slot, its model bytes and, where the drop brings textures, its texture bytes are the same: equal models with other textures, or for another ped or slot, are other garments, and the Duplicates chip is the same comparison (`equal_models_with_different_textures_are_added_and_equal_textures_are_the_garment_held`, `equal_models_with_different_textures_are_not_duplicates`). A name that says no ped or slot is never in the way of a drop: the garment is added with a `?`, and Say what they are… beside the counts opens a dialog that sets the ped and the slot of the garments picked that need it, or of all that do where none picked does, as one step of Undo, and leaves what a name did say as it was where the dialog is not given it (`the_button_beside_the_counts_opens_the_dialog_and_one_answer_says_what_all_three_are`, `three_garments_whose_names_say_nothing_are_given_their_ped_and_slot_in_one_step_and_one_undo_takes_it_back`). A drop is no longer cut at 20,000 files: it reads the folders whole, up to a million files, the header says how many garments of how many it has copied in, and Stop ends it with nothing added and the pack and its folder as they were (`a_drop_past_the_old_ceiling_of_twenty_thousand_files_reads_the_garments_after_it`, `a_big_drop_says_how_far_it_has_got_and_stop_leaves_the_pack_as_it_was`). - **Garment.** The garment selected: its name, which is the title of the panel and the field that changes it (its stable id is the tip), under it what is wrong with the garment (the worst problem with its Fix… and Waive…, and Show all for the rest), then its ped, slot, skin and position, each a row of a form with its label beside it (automatic or pinned), its model and textures with their tints, a Cloth section, a Flags section (the heels of shoes) and a closed Behaviour section (the behaviour flags the staged documents state, by the engine's names, with the rest as a number; the drawable's properties, or a prop's render flags and how firmly it stays on; what a hat does to the hair and how tall a hair stands; the audio ids, with the ids the game's own drawables of the slot state; the first person alternate; and the alternate variations the garment causes, with a set made from it or joined), a Shop section, and Remove from the pack, apart on a row of its own in the colour of an error, which Undo takes back. A texture takes one line whatever the panel's width, cut in the middle where it is too long so that its file's end, which has its letter and its tint, stays, with a row of tools under it: Replace… (an image or a `.ytd` takes its place, the tint and flags stay), More (move it earlier or later, which renames the letters it passes, write its file out under the game's name, or take it out, its file staying) and a field for its Tint; Add texture… adds the next one. Move garment earlier and later swap the garment's place with its neighbour's in its slot, Replace model… and Use a model source folder… put a `.ydd`, or a `.drawables.src` that a build cooks, in the place of its model, and Duplicate to the other ped and Export garment files… copy it to the other ped and write its files out under the game's names; the row's menu offers the move and the copy too, and each is in the palette, acting on the garment selected (`the_garment_panel_offers_each_operation_with_a_name_a_screen_reader_can_speak`, `a_rows_menu_copies_its_garment_to_the_other_ped_and_offers_to_move_it_in_its_slot`). Package garment… writes the garment selected as one package, `garment.json` beside its models and textures as sources and its cloth as it is, into the folder picked when that holds nothing and else into a folder of its own inside it, and changes nothing in the pack; Add package…, on the pack when no garment is selected, picks a package folder and adds the garment it holds to the pack as an equal garment with an id of its own, one step that Undo package takes out whole, with the shop id the pack already writes let go and said in the Log (`a_garment_is_packaged_from_its_panel_and_the_package_is_added_with_one_undo`). Cloth shows the file linked, or says the garment is missing the cloth its metadata states or has none, with Link cloth… and Unlink cloth, each an edit Undo takes back and each in the palette; the flag the game reads (`ownsCloth`) is no control, it follows the link. Shop shows, for each texture, the id the build writes, where it came from (read from a file and entry, chosen here, or named by the build) and its cost, with a field to give the texture another id and a button to go back to the imported one. Flags is shown for shoes only and holds Heels, a checkbox with the value the shoes state (1 is the value the game's own heels state): the engine writes it as the fifth `pedXml_expressionMods` of the feet drawable and the expression 4 that the staged creature metadata gives the same drawables, and a build reads both back (`heels_are_written_as_the_fifth_modifier_and_expression_4_and_taking_them_off_writes_neither`). Hide hair is offered for a hat as a preset that states the hair scale -1.0, measured on staged hats and not verified in game, and hide ears is not offered: the game states no flag for it that this build can name (`hide_hair_states_the_scale_staged_hats_state_for_a_hat_only_and_undo_takes_it_back`). Each control has the name a screen reader speaks (`the_cloth_and_shop_sections_of_a_garment_are_drawn_with_names_and_link_and_unlink_are_clicks`). With none selected it is the pack: its name, its collections, the Shop option that names the shop entries that state no id as Durty Cloth Tool does (off by default), the shop entries an import kept for want of a garment and the files carried with the shop, and the waivers the pack records, each with Remove. -- **The dressed ped.** Between the list and Garment, drawn through the viewport. `or_wardrobe::dress` says what each component slot wears, and `src/state/workbench/dressed.rs` reads those files on a worker, one request at a time, and hands the viewport a scene (`src/render/dressed.rs`) that the bridge draws in place of a document's meshes, with a camera of its own; `src/ui/panels/wardrobe/preview.rs` lays out the tools and the tiles. The garment selected is worn on its own ped (Male and Female choose another), and every slot nothing selects wears the ped's own drawable 0, named from the ped's variation metadata and read from the `streamedpeds_mp` archive of the mounted game once its keys are read. With no game install chosen, or while its keys are being read, the preview shows the garment alone and says so in a box over the top of the view, with Choose a game install… beside the sentence, and Skin and Without the pack are greyed with the reason, since the ped is drawn from the install (`no_game_install_is_said_over_the_view_with_the_way_to_choose_one_and_what_needs_it_is_greyed`); a mount that fails says why with Try the install again. Drag to orbit, the middle button or Shift to pan, the wheel to zoom, and Frame under the view brings the whole ped into it. The tools stand in rows that keep their places however wide the panel is, grouped by meaning: **who wears it** (Male and Female, Skin, Outfit and Heels, with Model and Alternates on a row of their own under them where the pack has them: a drop-down that does not fit a row goes whole to the next, and none runs past the panel, `the_model_and_the_alternates_stand_on_a_row_of_their_own_inside_the_panel_at_the_smallest_window`), **which version is shown** (Show), **how it is drawn** (Draw, Level and Tint), and **the ped's own parts, the motion and the pictures** (Ped without hair, Ped's own parts, Motion and Pictures). The view takes what is left of the panel, and under it stand its helpers (Bones, Grid, First person, Light and Frame), the notes and the texture tiles, which are one compact row when the panel is short, so that nothing is ever drawn over them (`the_view_has_the_room_at_the_smallest_window_and_is_not_drawn_over_the_tiles`, `the_tools_stand_in_rows_by_meaning_that_do_not_reflow`). The figures of what is drawn stand in the view's bottom left corner, and the modelling axes are left out of this view. The controls of a clip that plays (pause, Loop, Speed and Clip) stand in a row under the view, above the tiles, so that the legs and the shoes, which a garment is checked on, are never covered (`the_controls_of_a_clip_that_plays_stand_under_the_view_and_not_over_it`). **Draw** puts a line under each way of drawing that says what it draws, and offers Shaded only once the game's shaders are baked: before, it is greyed with the reason, since it would draw as Material (`the_draw_menu_offers_shaded_only_once_the_game_shaders_are_baked`). **Outfit** is a menu: Wear the outfit together wears the garments put in the outfit with the selected one on top (a later garment takes the slot of an earlier one, and a garment that is not worn is listed with the reason), Add the selected garment to the outfit (or Take it out) and Take everything off. **Tint** multiplies the garments' textures by a swatch, for this view only. **Skin** chooses one of the six tones of the ped's own head. **Heels** raises the ped by a tenth of the value the worn shoes state, and the Heels button of the view takes the lift off. **Show** chooses one of three, named in words: Without the pack (A in other clothing tools) is the ped as the game has it, and With the pack (B) is the ped wearing it; the original of a texture that was replaced is not kept, so Without the pack is not a before and after of an edit. Before the last change is the ped wearing the pack as it was before its latest change, read from the versions the Wardrobe keeps when it is pressed, so the pack can be set against its previous self in the viewport with With the pack, the pack as it is; a pack with no earlier version says so. **Ped without hair** takes the ped's own hair off for this view only, nothing written to the pack; it needs the install mounted, since the hair is the ped's own drawable, and the Hide hair of the Behaviour section is another thing, the preset that states the hair scale a hat asks for. **Ped's own parts** lists the other slots of the ped's own drawables in a table, Tops first, with the choices that differ from the game's drawn in the accent colour and a button that puts every part back (`before_wears_the_pack_as_it_was_before_its_latest_change_and_b_wears_it_as_it_is`). The ped is drawn at its rest pose, where a component's stored positions are the positions its skeleton gives it, so nothing is skinned, and a read file is read again when its size or time changes and whenever a recook reads a tab again. A prop is worn at `Prop::bone`, as the bullet on props below says (`a_selected_garment_is_worn_alone_when_no_game_is_mounted_and_the_preview_says_so`, `the_ped_wears_its_own_drawables_from_the_install_in_every_slot_nothing_selects`, `a_and_b_show_the_ped_without_the_pack_and_with_it`, `for_a_reference_pack_the_query_selects_the_drawables_and_textures_its_slots_state`, `a_hat_is_worn_at_the_bone_of_its_anchor_drawn_at_the_level_chosen_and_moves_with_the_bone`). +- **The dressed ped.** Between the list and Garment, drawn through the viewport. `or_wardrobe::dress` says what each component slot wears, and `src/state/workbench/dressed/mod.rs` reads those files on a worker, one request at a time, and hands the viewport a scene (`src/render/dressed.rs`) that the bridge draws in place of a document's meshes, with a camera of its own; `src/ui/panels/wardrobe/preview.rs` lays out the tools and the tiles. The garment selected is worn on its own ped (Male and Female choose another), and every slot nothing selects wears the ped's own drawable 0, named from the ped's variation metadata and read from the `streamedpeds_mp` archive of the mounted game once its keys are read. With no game install chosen, or while its keys are being read, the preview shows the garment alone and says so in a box over the top of the view, with Choose a game install… beside the sentence, and Skin and Without the pack are greyed with the reason, since the ped is drawn from the install (`no_game_install_is_said_over_the_view_with_the_way_to_choose_one_and_what_needs_it_is_greyed`); a mount that fails says why with Try the install again. Drag to orbit, the middle button or Shift to pan, the wheel to zoom, and Frame under the view brings the whole ped into it. The tools stand in rows that keep their places however wide the panel is, grouped by meaning: **who wears it** (Male and Female, Skin, Outfit and Heels, with Model and Alternates on a row of their own under them where the pack has them: a drop-down that does not fit a row goes whole to the next, and none runs past the panel, `the_model_and_the_alternates_stand_on_a_row_of_their_own_inside_the_panel_at_the_smallest_window`), **which version is shown** (Show), **how it is drawn** (Draw, Level and Tint), and **the ped's own parts, the motion and the pictures** (Ped without hair, Ped's own parts, Motion and Pictures). The view takes what is left of the panel, and under it stand its helpers (Bones, Grid, First person, Light and Frame), the notes and the texture tiles, which are one compact row when the panel is short, so that nothing is ever drawn over them (`the_view_has_the_room_at_the_smallest_window_and_is_not_drawn_over_the_tiles`, `the_tools_stand_in_rows_by_meaning_that_do_not_reflow`). The figures of what is drawn stand in the view's bottom left corner, and the modelling axes are left out of this view. The controls of a clip that plays (pause, Loop, Speed and Clip) stand in a row under the view, above the tiles, so that the legs and the shoes, which a garment is checked on, are never covered (`the_controls_of_a_clip_that_plays_stand_under_the_view_and_not_over_it`). **Draw** puts a line under each way of drawing that says what it draws, and offers Shaded only once the game's shaders are baked: before, it is greyed with the reason, since it would draw as Material (`the_draw_menu_offers_shaded_only_once_the_game_shaders_are_baked`). **Outfit** is a menu: Wear the outfit together wears the garments put in the outfit with the selected one on top (a later garment takes the slot of an earlier one, and a garment that is not worn is listed with the reason), Add the selected garment to the outfit (or Take it out) and Take everything off. **Tint** multiplies the garments' textures by a swatch, for this view only. **Skin** chooses one of the six tones of the ped's own head. **Heels** raises the ped by a tenth of the value the worn shoes state, and the Heels button of the view takes the lift off. **Show** chooses one of three, named in words: Without the pack (A in other clothing tools) is the ped as the game has it, and With the pack (B) is the ped wearing it; the original of a texture that was replaced is not kept, so Without the pack is not a before and after of an edit. Before the last change is the ped wearing the pack as it was before its latest change, read from the versions the Wardrobe keeps when it is pressed, so the pack can be set against its previous self in the viewport with With the pack, the pack as it is; a pack with no earlier version says so. **Ped without hair** takes the ped's own hair off for this view only, nothing written to the pack; it needs the install mounted, since the hair is the ped's own drawable, and the Hide hair of the Behaviour section is another thing, the preset that states the hair scale a hat asks for. **Ped's own parts** lists the other slots of the ped's own drawables in a table, Tops first, with the choices that differ from the game's drawn in the accent colour and a button that puts every part back (`before_wears_the_pack_as_it_was_before_its_latest_change_and_b_wears_it_as_it_is`). The ped is drawn at its rest pose, where a component's stored positions are the positions its skeleton gives it, so nothing is skinned, and a read file is read again when its size or time changes and whenever a recook reads a tab again. A prop is worn at `Prop::bone`, as the bullet on props below says (`a_selected_garment_is_worn_alone_when_no_game_is_mounted_and_the_preview_says_so`, `the_ped_wears_its_own_drawables_from_the_install_in_every_slot_nothing_selects`, `a_and_b_show_the_ped_without_the_pack_and_with_it`, `for_a_reference_pack_the_query_selects_the_drawables_and_textures_its_slots_state`, `a_hat_is_worn_at_the_bone_of_its_anchor_drawn_at_the_level_chosen_and_moves_with_the_bone`). - **Texture variants.** Under the ped, a tile for each texture of the garment selected, with its picture, its letter and its file: a click wears it. An image dropped on a tile makes that texture from the image: a textures source the variation names in place of the old texture (`or_wardrobe::replace::texture`), which stays where it was. An image editor saves in the source's folder, where the live recook cooks it, so nothing is kept beside a compiled file and opening a project never rewrites a texture; an image that makes no texture is said and leaves the texture as it was. There is no convert button, and Undo names the old texture again (`an_image_dropped_on_a_tile_makes_that_variations_texture_and_the_preview_shows_it`, `a_texture_replaced_from_its_row_is_one_click_from_undo`). - **Linked clothing.** A clothing content that is a link is read in the Wardrobe and never written: a banner over the list says which project edits it, with Open project, Add clothes… is unavailable with the reason, the drop area says nothing can be dropped, Garment is greyed, Problems lists its findings with no Fix… or Waive…, and a drop on the panel or any edit that gets through is refused with a sentence that names that project, since the project that holds a folder is its only writer. Every write the Wardrobe makes asks the engine's module_folder_to_edit first (`a_linked_pack_is_shown_in_the_wardrobe_and_every_edit_of_it_is_refused_naming_the_project_that_writes_it`, `a_linked_pack_is_read_in_the_wardrobe_with_its_project_named_and_nothing_to_add_or_drop`). - **Problems.** The engine's findings of a clothing content, an error or a warning, join the others, each with the fix and the waiver its rule offers; a note (a place held) is not a problem, and a finding a waiver sets aside is not listed. A sentence is plain: no rule code in front, no backticks, no module or output word, and it does not begin with the name of the garment its row already names, nor with that name's possessive (`every_rule_says_what_is_wrong_in_a_plain_sentence`, `the_sentence_of_a_garments_finding_has_no_rule_code_no_backtick_and_no_repeat_of_the_name_its_row_shows`, `no_rule_that_reads_a_count_begins_its_sentence_with_the_name_the_row_shows`). Fix… asks first and says in a sentence exactly what it changes; Waive… asks for a reason and records it in `wardrobe.json`. A texture a garment names that is not there offers Locate…, which asks for the file and copies it into the pack, and Remove, which takes that texture off the garment, the later ones moving up a letter; a cloth the pack names and has not got offers the same two, and a garment whose metadata states `ownsCloth` with no cloth linked offers Locate…, Fix… and Waive…. A file that is not there offers no waiver, since no reason mends it (`a_texture_that_is_not_there_offers_locate_and_remove_and_each_is_a_step_of_undo`, `a_cloth_the_metadata_expects_or_the_pack_names_and_lacks_offers_locate_beside_the_fix_its_rule_gives`). What a file states of itself is held to a limit too: twelve rules read the size, mips and format of each texture, the levels of detail, shaders and embedded textures of each model and the memory a dictionary takes, each a warning (a note for a model with no medium or low level, which the game's own often have), and a garment with many textures at fault is one row that counts them and names the first (`each_rule_finds_the_texture_file_built_to_break_it_and_a_clean_one_is_silent`). Rules… opens the rules of the clothing content in two headed sections: What a build does (the edition the pack is built for, both, Legacy or Enhanced, the freeze, the empty places and replacing the game's files) and Checks, where each rule a reason could set aside has a bold title of its own (`Garment moved since the last build`), the line that says what it is about and whether it is on, how serious it is under a How serious heading, where its limit stands and a Reset that waits for a change, with Reset all checks under them; Apply waits for a change too and says so, and the whole drafted in the window and made the pack's rules by Apply as one step of Undo (`the_rules_window_switches_a_rule_off_and_raises_another_as_one_step_that_undo_takes_back`); the rules no reason mends are listed under Always on and do not change, and Export the list… writes every rule with its limit (`the_list_written_out_reads_back_as_rules_row_for_row`). The plan's own sentence for a finding that blocks a build is not listed a second time. A validator plugin's finding offers Waive… and, when the plugin suggested a fix, Fix…: it lists the files the fix writes, each as a new file or one it replaces, and Apply the fix writes them together as one step of Undo, checked as a set first, so a game file, a file of the project's own (a `.openrage`, `build` or `.git` folder at any depth, in any letters) or a `wardrobe.json` that would not read refuses the whole set with a sentence and nothing is written (`a_validator_suggests_a_fix_and_reads_the_pack`). When two packs state one sentence, each row offers the fix of its own finding (`two_errors_with_one_text_each_offer_the_fix_of_their_own_finding_in_their_own_plan`). diff --git a/docs/direction/World_Editor_Parity.md b/docs/direction/World_Editor_Parity.md index 854afeeac..e677a789c 100644 --- a/docs/direction/World_Editor_Parity.md +++ b/docs/direction/World_Editor_Parity.md @@ -51,7 +51,7 @@ Seeing the map, moving through it and finding a thing in it. The world drawn is | Capability | For | Against | Verdict | Row | |---|---|---|---|---| -| The whole map in 3D with its models, textures, interiors and levels of detail | Every other row stands on it; the streaming rules and the world renderer exist today and draw a GTA VI install | The largest row; GTA V's mount, index and materials are not GTA VI's, and the viewer is one for the whole app today (`src/state/gta6_worldview/mod.rs`), where an install's tab and a project's tab need one each | Take | R70b, R70c | +| The whole map in 3D with its models, textures, interiors and levels of detail | Every other row stands on it; the streaming rules and the world renderer exist today and draw a GTA VI install | The largest row; GTA V's mount, index and materials are not GTA VI's, and the viewer is one for the whole app today (`src/state/gta6/world/gta6_world/worldview/mod.rs`), where an install's tab and a project's tab need one each | Take | R70b, R70c | | Shadows, water, sky and an hour of the day | For GTA VI the World screen is lit today from the install's timecycle and weather, casts the sun's shadow in four cascades (`crates/runtime/or-renderer/src/world/shadow.rs`) and draws a sky and water; GTA V's timecycle is parsed today (`crates/io/or-io/src/gta5/data/timecycle/mod.rs`), which NodeRunner does not read | No reader of GTA V's `water.xml`; which parts of the day are GTA VI's alone is not written down; the cost of every material through the game's own shaders over a whole map is unmeasured | Adapt: GTA V's files feed what the World screen has | R70d | | The map as of a level of DLC | A server pins a build of the game; the mount takes a level to stop at today (`DlcCutoff` in `crates/title/or-title/src/vfs/game_mount.rs`), and `openrage-cli` takes it as `--dlc`, by pack or by build number | Every call of the app mounts every pack, and no index is keyed by the level | Have: the screen passes the level and the index is keyed by it | R70b | | The map as story mode or as multiplayer | The two load different maps, and a server runs the second | Nothing in the tree makes this choice for GTA V | Take | R70b | @@ -430,7 +430,7 @@ What NodeRunner's settings hold, against what OpenRage keeps today. The World sc | The default form of a copy | None | Adapt: the last form used | R70e | | The ground grid's cell size and colour | A grid switch for a model's viewport | Take the cell size | R70v | | The radius of the collision, navmesh and object box layers | None | Take, in the Layers panel and on the page | R70f, R70v | -| Interface size and accent colour | Preferences today (`ui_scale_percent` and `accent` in `src/state/prefs.rs`) | Have | | +| Interface size and accent colour | Preferences today (`ui_scale_percent` and `accent` in `src/state/prefs/mod.rs`) | Have | | | The folders of the projects and of the library | A project is a folder the person chooses, and a library is a project the others link | Adapt: no folder is set once for all | | | The keys | A page of Settings | Have: with presets | R70v | | Restore defaults | For the keys | Take, for the mapper's page | R70v | diff --git a/docs/direction/World_Editor_Plan.md b/docs/direction/World_Editor_Plan.md index d34a2fa4a..395d8011f 100644 --- a/docs/direction/World_Editor_Plan.md +++ b/docs/direction/World_Editor_Plan.md @@ -44,8 +44,8 @@ What a row can stand on, and what is absent. The paths are the ones to read firs | Maps that load together, and the manifest of a set | `MapGroup`, `crates/domain/or-world-gta5/src/streaming/manifest.rs`, `openrage-cli world manifest`. A Maps content writes `_manifest.ymf` from the manifests of the game it keeps (`crates/domain/or-world-gta5/src/authoring/manifest_build.rs`), with a derived entry for a map none of them states, its flags by a rule every entry of two installs follows | The lists a derivation does not give, the entry an interior's type file is stated by, and a manifest for a content that keeps none | | Creating and deleting a map with every link kept across files | `WorkingSet` in `crates/domain/or-world-gta5/src/authoring/execute.rs`. `crates/domain/or-maps/src/delete.rs` takes an entity out with its chain of far models across the map files a pack holds as sources, over the typed roots and with no schema snapshot, behind `openrage-cli maps delete` and the Map screen's Delete, which does the plan as one step of Undo | A map created or deleted is reached from `openrage-cli world` only, and written only where a schema snapshot is staged, which is no user's machine; a deletion reaches a map of the game that is not a source yet only as the first edit of an object, which no screen plans, and the Map screen shows no preview of the one it does | | Which maps the game requests at an hour and a weather, or only by script | `crates/domain/or-world-gta5/src/streaming/state.rs`; the GTA VI World panel lists the script-managed groups | No screen uses it for GTA V | -| A 3D scene with a manipulator | The Map screen: Scene, Plan, Selection, `or_maps::gizmo`, a grid step and the ground of boxes. Its edits and its Undo go through a session of the pack, written when the project is saved, and its steps are its own stack of operations and their inverses, in memory (`src/state/workbench/maps.rs`). The Scene also serves a scanned GTA VI map body (`src/state/gta6_map.rs`) | Boxes, no model; one set of a project; the ground is the highest box, not collision | -| A whole map streamed and drawn | The rules of `crates/domain/or-world/src/streaming.rs`, the instanced draws of `crates/runtime/or-renderer/src/world.rs`, the fly camera of `crates/runtime/or-renderer/src/fly.rs`, the budgets and the occluder buffer beside `src/state/gta6_worldview/`. `crates/domain/or-world-gta5/src/streaming/world_forest/mod.rs` streams a GTA V install's maps for a view and selects their entities by those rules, with no screen (`openrage-cli world select`). For GTA VI also the install's day, the sun's shadow in cascades (`crates/runtime/or-renderer/src/world/shadow.rs`), the game's lighting passes, lamps, a sky and water ([the day](../features/GTA_VI_World_Viewer.md#the-modes)) | Drawn for a GTA VI install only: nothing feeds the renderer the models of GTA V. World is a workspace on the rail while a GTA VI folder is set, with one viewer for the app (`src/state/gta6_worldview/mod.rs`) | +| A 3D scene with a manipulator | The Map screen: Scene, Plan, Selection, `or_maps::gizmo`, a grid step and the ground of boxes. Its edits and its Undo go through a session of the pack, written when the project is saved, and its steps are its own stack of operations and their inverses, in memory (`src/state/workbench/maps.rs`). The Scene also serves a scanned GTA VI map body (`src/state/gta6/world/gta6_map/mod.rs`) | Boxes, no model; one set of a project; the ground is the highest box, not collision | +| A whole map streamed and drawn | The rules of `crates/domain/or-world/src/streaming.rs`, the instanced draws of `crates/runtime/or-renderer/src/world.rs`, the fly camera of `crates/runtime/or-renderer/src/fly.rs`, the budgets and the occluder buffer beside `src/state/gta6/world/gta6_world/worldview/`. `crates/domain/or-world-gta5/src/streaming/world_forest/mod.rs` streams a GTA V install's maps for a view and selects their entities by those rules, with no screen (`openrage-cli world select`). For GTA VI also the install's day, the sun's shadow in cascades (`crates/runtime/or-renderer/src/world/shadow.rs`), the game's lighting passes, lamps, a sky and water ([the day](../features/GTA_VI_World_Viewer.md#the-modes)) | Drawn for a GTA VI install only: nothing feeds the renderer the models of GTA V. World is a workspace on the rail while a GTA VI folder is set, with one viewer for the app (`src/state/gta6/world/gta6_world/worldview/mod.rs`) | | The game's picture for GTA V | The Shaded viewport draws one model with GTA V's own passes, the install's timecycle, its sky and its water pass | One shadow tile, the sun alone. Nothing feeds GTA V's day to the world or draws its water: `crates/io/or-io/src/gta5/data/water/mod.rs` reads and saves a `water.xml`, held on documents written by hand and on the water files of two installs | | Collision | `crates/domain/or-world/src/collision/` answers a ray, a swept sphere, a box overlap and the ground over the bounds its caller hands it; `BvhCollider` in `crates/runtime/or-simulation/src/collision.rs` casts a ray at one bound, for particles; `crates/io/or-io/src/gta5/bounds/build.rs` builds and rebuilds a bound; `crates/domain/or-source/src/bounds/mod.rs` holds a changed bound as a source over the game's file. `crates/domain/or-world-gta5/src/archetypes/world_collision.rs` hands the query the static bounds of a mount's column under a budget of bytes, behind `openrage-cli world ground`. `crates/domain/or-world-gta5/src/map/doors/` finds the doors of a set of maps and opens each through its arc against the query and the boxes near it, behind `openrage-cli maps doors`, of a project's map sets or of one map file of a mounted install. `crates/domain/or-maps/src/collision.rs` proposes the polygons under a placed object and takes them out, retypes or moves them (`openrage-cli maps collision`) | The collision of an interior and of a placed prop, which the entity's placement puts in the world; a screen that asks the query; a door's tuning; a screen that edits a polygon; the compare of a bound's source with its base | | Roads, navmesh, scenario points | `.ynd` and `.ynv` owned and saved, the navmesh drawn, scenario regions typed; `crates/domain/or-source/src/paths.rs` holds a changed `.ynd` as a source, in a form that awaits the owner's word. `crates/domain/or-maps/src/roads/` edits the road graph of a folder of such sources by operations with inverses, each stating the set of documents it applies to, and holds its rules, behind `openrage-cli maps roads` | Roads and scenario points are not drawn, and no screen edits a road; a node disabled, which the file states no state for, and the lanes of a link, which its word does not name; an edit of a scenario point; the compare of a path region's source with its base | @@ -128,7 +128,7 @@ Each edge was read against the crate's `Cargo.toml` and [Crate_Reference.md](../ | What a server's resources ship and claim | `or-project`, beside adoption and the claims | The plan's vocabulary; no map is opened | | The motion of a walking character | `or-simulation`, over the collision query | The edge to `or-world` points down. The app plays the clip with `or-anim`, which stays apart from `or-simulation` ([runtime crates](../reference/Crate_Reference.md#runtime-crates)) | | The session of several people: the order of the operations and the wire, as bytes it does not read | A new foundation crate that opens no socket; the app encodes the operations and owns the connection | A foundation crate cannot know the operations of `or-maps` | -| The streamer for GTA V, the layers, the tools, the panels, and the seam between GTA V and GTA VI | The app. The seam is declared beside `src/state/gta6_worldview/`, where GTA VI's index, materials, lights, sky and water are, and says what a title supplies | `or-renderer` opens no file and does not depend on `or-world` | +| The streamer for GTA V, the layers, the tools, the panels, and the seam between GTA V and GTA VI | The app. The seam is declared beside `src/state/gta6/world/gta6_world/worldview/`, where GTA VI's index, materials, lights, sky and water are, and says what a title supplies | `or-renderer` opens no file and does not depend on `or-world` | A new edge that points up is refused as ever: `or-maps` does not see the renderer, and the manipulator stays maths. Nothing reaches the network unless a person asks; the one client in the tree is behind `openrage-cli script download-natives`. @@ -200,7 +200,7 @@ Checks ([R70b](Roadmap.md#r70b-the-gta-v-world-index)): over a mounted install t ### The GTA V world streamed and drawn (R70c) -Read [GTA_VI_World_Viewer.md](../features/GTA_VI_World_Viewer.md), `crates/domain/or-world/src/streaming.rs`, `src/state/gta6_worldview/mod.rs`, `src/ui/panels/rail.rs`, `src/ui/dock.rs` and `src/state/gta6_map.rs`. +Read [GTA_VI_World_Viewer.md](../features/GTA_VI_World_Viewer.md), `crates/domain/or-world/src/streaming.rs`, `src/state/gta6/world/gta6_world/worldview/mod.rs`, `src/ui/panels/rail.rs`, `src/ui/dock.rs` and `src/state/gta6/world/gta6_map/mod.rs`. Build in parts, each on its own check. First the seam between what the World screen takes from a title (where maps, models and textures come from, how a material is drawn, what feeds its day) and what it shares (the selection of levels, the budgets, the wait for textures, the occluder buffer, the camera). Then the viewer made one for each world tab. Then the GTA V feed from R70b: models, textures and materials for both targets, interiors and their objects, and the content a project links, drawn as its layer of the stack. Then the room, the tab and the Map content's Scene as [one world, two doors](#one-world-two-doors) has them. diff --git a/docs/direction/World_Editor_UX_Design.md b/docs/direction/World_Editor_UX_Design.md index 67ec05093..dc8f85b79 100644 --- a/docs/direction/World_Editor_UX_Design.md +++ b/docs/direction/World_Editor_UX_Design.md @@ -12,7 +12,7 @@ Each subsection names in parentheses the row that builds it, and that row settle ### What the window is today -- Today the rail at the left edge has Home, Game, World, Project and Automate (`src/ui/panels/rail.rs`). World is on it only while a GTA VI folder is set, and it opens a workspace, not a tab: the view with the World panel beside it and nothing docked under it (`world_layout` in `src/ui/dock.rs`). The app holds one viewer today (`src/state/gta6_worldview/mod.rs`). +- Today the rail at the left edge has Home, Game, World, Project and Automate (`src/ui/panels/rail.rs`). World is on it only while a GTA VI folder is set, and it opens a workspace, not a tab: the view with the World panel beside it and nothing docked under it (`world_layout` in `src/ui/dock.rs`). The app holds one viewer today (`src/state/gta6/world/gta6_world/worldview/mod.rs`). - A project's screens are today tabs before the tabs of its files, Project first. A bar under the tabs offers a file's primary command, and a screen of the project has none ([Switch view](Workbench_UX_Design.md#switch-view)). - One panel, Details, shows today what is selected ([R69g](Roadmap.md#r69g-one-details-panel)), and the window has one Build control, at the right of the menu bar ([R69c](Roadmap.md#r69c-one-build-control-and-a-save-that-offers-what-can-happen)). - The Map screen draws today a box for each entity ([what the Map screen builds](Workbench_UX_Design.md#what-the-map-screen-builds)). diff --git a/docs/features/Animation_Preview.md b/docs/features/Animation_Preview.md index 9938d5f48..6617bb18f 100644 --- a/docs/features/Animation_Preview.md +++ b/docs/features/Animation_Preview.md @@ -74,7 +74,7 @@ The preview draws what its sources hold now, whichever document is active. The s ⚠ With no mesh added the preview draws the skeleton source's own drawable, and a ped's `.yft` holds a 25 metre square plane as its only geometry, so it draws that (`a_peds_fragment_chosen_alone_draws_the_one_plane_its_own_bounds_state`). The box "Draw the skeleton file's own model" in the skeleton section of Preview settings hides it (`PreviewScene::draw_skeleton_model`, ticked by default): the skeleton, its bones and every mesh source are drawn as before, and a restart keeps the choice (`Prefs::draw_skeleton_model`). A mesh source added is drawn with the box either way, and with it unticked and no mesh source the viewport draws only the bones (`unticking_the_box_draws_no_mesh_but_the_skeleton_and_a_mesh_source_added_is_still_drawn`). -The bones are drawn from the skeleton source whether or not a clip drives it (`src/render/viewport/bones.rs`, which the lines, the click and the viewport's corner box all ask). Posed by the clip where one binds, they are at rest where none is chosen and where the clip does not fit the skeleton (the session is cleared for it, so it holds no pose), built from the bones of the skeleton source's own document. Show bones (`PreviewScene::show_bones`) starts ticked, and the Bones box in the viewport's row is the same flag here. Outside this workspace the viewport's own Bones box (`PreviewScene::show_rest_bones`, off by default) draws the skeleton of the drawable it draws at rest, the bone selected in the Outline highlighted and a click on a line selecting its row (`src/state/a_skeleton_is_seen_without_an_animation.rs`). +The bones are drawn from the skeleton source whether or not a clip drives it (`src/render/viewport/bones.rs`, which the lines, the click and the viewport's corner box all ask). Posed by the clip where one binds, they are at rest where none is chosen and where the clip does not fit the skeleton (the session is cleared for it, so it holds no pose), built from the bones of the skeleton source's own document. Show bones (`PreviewScene::show_bones`) starts ticked, and the Bones box in the viewport's row is the same flag here. Outside this workspace the viewport's own Bones box (`PreviewScene::show_rest_bones`, off by default) draws the skeleton of the drawable it draws at rest, the bone selected in the Outline highlighted and a click on a line selecting its row (`src/state/tests/a_skeleton_is_seen_without_an_animation.rs`). ## Coverage @@ -119,9 +119,9 @@ A pose step in the clip document's history holds the whole layer the edit replac - `crates/runtime/or-anim/tests/skinning.rs`: weights sum to one, every influence names a real bone, and bind-pose skinning returns the authored vertices, over 316,575 vertices in 49 skinned drawables (at `d4838113`). - `crates/runtime/or-anim/tests/what_a_matrix_palette_addresses.rs`: palettes hold indices, and the retarget moves them where an index would not. - `crates/runtime/or-anim/tests/edit_roundtrip.rs`: edit, bake, save, reload and play, over a clip dictionary the test builds, so it needs no corpus. -- `src/state/editing_a_clip.rs`: undo, redo, clip fields, and the bake refused with no skeleton bound. -- `src/state/the_animation_preview_draws_what_its_sources_hold.rs`: a bone edit poses the skeleton again, a mesh source binds its own embedded textures while a clip dictionary is active, and what a ped's fragment draws alone. -- `src/state/the_animation_preview_follows_its_sources.rs`: another clip chosen while paused is posed, a mesh source's textures are ranked and pinned for it and its levels of detail listed while a clip dictionary is active, a closed mesh source leaves the list, and a Looped edit made while a clip is skipped wins when it is allowed again. +- `src/state/tests/editing_a_clip.rs`: undo, redo, clip fields, and the bake refused with no skeleton bound. +- `src/state/tests/the_animation_preview_draws_what_its_sources_hold.rs`: a bone edit poses the skeleton again, a mesh source binds its own embedded textures while a clip dictionary is active, and what a ped's fragment draws alone. +- `src/state/tests/the_animation_preview_follows_its_sources.rs`: another clip chosen while paused is posed, a mesh source's textures are ranked and pinned for it and its levels of detail listed while a clip dictionary is active, a closed mesh source leaves the list, and a Looped edit made while a clip is skipped wins when it is allowed again. ## Known gaps diff --git a/docs/features/GTA_VI_Builds.md b/docs/features/GTA_VI_Builds.md index 325e8cc17..291f55eab 100644 --- a/docs/features/GTA_VI_Builds.md +++ b/docs/features/GTA_VI_Builds.md @@ -9,38 +9,38 @@ GTA VI is a title of its own (`crates/title/or-title/src/game/profiles.rs`) with A PlayStation 5 build is a build of its own (`Gta6Ps5`), known by the title id its package states, and it reads through the same readers as the Xbox Series build: the rest of this document describes both, and this section says where they differ. [GTA_VI_Platforms_Plan.md](../direction/GTA_VI_Platforms_Plan.md) has the design. - **A file states its platform.** An archive's header and a texture pack's directory each hold the platform's letter, and a reader takes what differs by platform from `crates/io/or-io/src/gta6/platform.rs`, never from the install. -- **Each build is read with its own keys.** The keys come out of the build's own executable, `eboot.bin` here, and they are handed to the open: an archive opens with `RpfArchive::open_with` and the `Gta6Context` of its build, and no reader takes keys from the process or the environment (`crates/io/or-io/src/container/rpf/rpf9/gta6_rpf.rs`). Two builds open at once, each read with its own keys (`two_builds_open_at_once_each_reading_with_its_own_session`). The app picks the keys by the platform letter an archive's header states (`src/state/rpf_archive_open.rs`), and the CLI has one loader for either build (`crates/tools/or-cli/src/gta6/keys.rs`). +- **Each build is read with its own keys.** The keys come out of the build's own executable, `eboot.bin` here, and they are handed to the open: an archive opens with `RpfArchive::open_with` and the `Gta6Context` of its build, and no reader takes keys from the process or the environment (`crates/io/or-io/src/container/rpf/rpf9/gta6_rpf.rs`). Two builds open at once, each read with its own keys (`two_builds_open_at_once_each_reading_with_its_own_session`). The app picks the keys by the platform letter an archive's header states (`src/state/rpf/rpf_archive_open/mod.rs`), and the CLI has one loader for either build (`crates/tools/or-cli/src/gta6/keys.rs`). - **Most archives come as a pair**, `X.rpf` and `X_concat.rpf`, which `crates/title/or-title/src/install/gta6_files.rs` lists side by side. They are two whole archives: every row's body lies in the file that holds the row, so no row of `X.rpf` names a body in `X_concat.rpf`, and a `_concat` holds nothing but nested archives, each of which mounts. `crates/io/or-io/tests/gta6_pairs_rule.rs` holds the rule over the build's 40 archives, 19 of them a `_concat` in 16 pairs. - **A body is stored with no coder, or as raw DEFLATE.** Where the Xbox Series build stores a body as zlib chunks, this one stores it as it is. A headerless resource is a zero slot and then its two sections, whose length its row states; a row whose type code sets bit 8 holds the two sections as raw DEFLATE streams instead, which the build's acceleration and script rows do; and a sized row with no chunk table whose stored size is its real size is read by that size (`crates/io/or-io/src/container/rpf/rpf9/gta6_mount.rs`, `crates/io/or-io/src/container/rpf/rpf9/gta6_kinds.rs`). With no key, a scan names the stored bodies by their first bytes (`crates/io/or-io/src/container/rpf/rpf9/rpf9_scan/stored.rs`). ⚠ Such a body has an end only where its row or its bytes state one. - **Every kind reads as on the Xbox Series.** `crates/io/or-io/tests/gta6_two_build_census.rs` opens both builds in one process, counts every row of every archive at any depth by its kind and reads a sample of each kind's bodies: every table opens and every sampled body reads on both, with no difference between them. The builds differ in what they ship: this one holds 40 archives where the Xbox Series holds 22, and twice the acceleration rows, in packs of two widths. - **Its script programs read.** A compiled script there is the same headerless resource, enciphered and held as raw DEFLATE, and it deciphers and inflates to the sections its row states. The container is the one both builds share: the reader selects the build id and native-anchor stamp from the build the file states at header +0x1C, so all 746 programs of this build read as the Xbox Series build's 746 do, and decode to the same instruction totals under the one opcode table (`crates/io/or-io/tests/gta6_script_programs.rs`). Only those two per-executable stamps differ; a build neither of them names is refused by name. - **Its shader packs are the same container with another binding layout, and are refused.** Its `shaders.rpf` holds two `SGD5` effect containers as the Xbox Series one does. The Xbox Series build's open, 26,503 programs and 932 effects whose streams inflate to `DXBC` containers; this build's are refused by name at their first binding layout, whose head states a count that is not its record count (88 for 28 records), so its programs are not reached. `crates/io/or-io/tests/gta6_shader_packs.rs` holds both. -- **Its texture packs read, and a 2D texture is replaced in place.** A pack there has no row table and no coder: the file is the image its directory points into, in the PlayStation 5's own order inside a 64 KiB tile (`crates/io/or-io/src/gta6/tiling_prospero.rs`). A replaced 2D texture is tiled over its own bytes and the file is written as it is around them, so nothing moves and saving the saved pack is byte-identical (`crates/io/or-io/src/gta6/ttpf_write.rs`). Replaced by itself, each 2D texture tried over the build's 56 packs is written as the bytes its file holds (`a_2d_texture_of_a_playstation_5_build_replaced_by_itself_changes_no_byte`). An edit of a cube, an array or a volume, a new shape and a new layout are written as rows, which this file has none of, and each is refused by the platform's name. +- **Its texture packs read, and a 2D texture is replaced in place.** A pack there has no row table and no coder: the file is the image its directory points into, in the PlayStation 5's own order inside a 64 KiB tile (`crates/io/or-io/src/gta6/tiling_prospero.rs`). A replaced 2D texture is tiled over its own bytes and the file is written as it is around them, so nothing moves and saving the saved pack is byte-identical (`crates/io/or-io/src/gta6/ttpf/write/mod.rs`). Replaced by itself, each 2D texture tried over the build's 56 packs is written as the bytes its file holds (`a_2d_texture_of_a_playstation_5_build_replaced_by_itself_changes_no_byte`). An edit of a cube, an array or a volume, a new shape and a new layout are written as rows, which this file has none of, and each is refused by the platform's name. - **What is not measured here.** The suites that walk a build pin the Xbox Series build's counts, and those that are not yet stated per build fail on this one for that reason alone. Its audio was counted with `openrage-cli awc census` over 400 of each build's 19,025 containers, which state the same chunks on both, an Opus format for 8,358 of 8,645 streams; no stream was decoded for the count. ## An archive is read from its table An RPF9 archive's header is in the clear, and its table of contents is enciphered with keys that are in the game's executable. OpenRage ships no key: it reads them out of the user's own executable, and [GTA_VI_Modding.md](../guides/GTA_VI_Modding.md#give-openrage-your-executables-keys) gives the steps. With them, an archive opens behind `RpfArchive` as `RpfVersion::Rpf9` and is browsed as a GTA V archive is. -- **One Files tree.** An archive the app opens is a folder of the Files tree, a nested archive is a folder in it, and a double-click opens an entry (`src/state/rpf_archive_open.rs`). An entry is read through its row's chunk table (`crates/io/or-io/src/container/rpf/rpf9/gta6_mount.rs`, `crates/io/or-io/src/container/rpf/rpf9/gta6_chunk_table.rs`), and an enciphered one is deciphered on a worker with the content key (`crates/io/or-io/src/container/rpf/rpf9/gta6_content.rs`). +- **One Files tree.** An archive the app opens is a folder of the Files tree, a nested archive is a folder in it, and a double-click opens an entry (`src/state/rpf/rpf_archive_open/mod.rs`). An entry is read through its row's chunk table (`crates/io/or-io/src/container/rpf/rpf9/gta6_mount.rs`, `crates/io/or-io/src/container/rpf/rpf9/gta6_chunk_table.rs`), and an enciphered one is deciphered on a worker with the content key (`crates/io/or-io/src/container/rpf/rpf9/gta6_content.rs`). - **Names.** A row names its entry by the 64-bit hash of its path. The tree shows the text where OpenRage holds a name that hashes to it, and the hash otherwise; the names are a folder of names `OPENRAGE_GTA6_NAMES` names, or with none named the folder a package ships beside the executable from `assets/gta6_names/vocabulary.txt`, the table `hashes mine` writes into the configuration folder and the harvest kept there ([below](#names-naming-rules-and-use-labels)), read into one cache there (`crates/io/or-io/src/container/rpf/rpf9/gta6_name_cache.rs`), then, in the app, the names of the default hash index (the installed schema snapshot's, the public names and the parser names), each under its path hash, and last the bundled words, plain words in `or-io`'s data files with no path, hash or game file extension. [GTA_VI_Modding.md](../guides/GTA_VI_Modding.md#names) says where each is kept. - **Kinds.** A row states what its entry is, a 24-byte row by its class byte and a 20-byte row by its resource type code (`crates/io/or-io/src/container/rpf/rpf9/gta6_kinds.rs`). The tree and the Files table show each row's kind, and the filter matches a kind's words and the GTA V extension of the same kind. The Inspector shows a selected entry's kind, its stored and real sizes, whether it is enciphered, the shape of its row and, where no name is held, its name hash (`src/ui/panels/inspector/rpf9_entry.rs`). -- **The tree's actions.** A single click opens a row in the preview tab, read on the load worker as a double-click reads it, and Copy hash gives the 64-bit path hash the table states, in the `0x` form the filter finds a row by (`src/state/rpf9_tree_actions.rs`). -- **Extract and save from the tree.** Extract writes a row's body as the open reads it, a clear headerless resource in the loose form OpenRage reopens (`src/state/rpf9_tree_verbs.rs`). A document opened from a row of an archive opened on its own saves into that row, on a worker, as a GTA V entry's document saves into its archive (`src/state/rpf9_tree_bind.rs`). The tree's edits are never written into the archive they were read from: Save as… writes them to a new file, as [How an edit is saved](#how-an-edit-is-saved) says. +- **The tree's actions.** A single click opens a row in the preview tab, read on the load worker as a double-click reads it, and Copy hash gives the 64-bit path hash the table states, in the `0x` form the filter finds a row by (`src/state/rpf/rpf9_scan/rpf9_tree_actions.rs`). +- **Extract and save from the tree.** Extract writes a row's body as the open reads it, a clear headerless resource in the loose form OpenRage reopens (`src/state/rpf/rpf_archive_open/tree_verbs/mod.rs`). A document opened from a row of an archive opened on its own saves into that row, on a worker, as a GTA V entry's document saves into its archive (`src/state/rpf/rpf_archive_open/tree_open/bind/mod.rs`). The tree's edits are never written into the archive they were read from: Save as… writes them to a new file, as [How an edit is saved](#how-an-edit-is-saved) says. - **Finding a file.** Go to File finds a file anywhere in an install and in each folder and archive Files shows, nested archives included, from an index of paths walked off the UI thread and kept between runs, and a query is answered on a thread of its own, so typing never waits for it (`src/state/file_index/mod.rs`). A file is found by words its path holds, in any order and any case, or by a word that is a hash of its name, a GTA VI row's 64-bit hash as its table states it among them; a file a hash names sorts first. The filters are `kind:` a kind as Files names it, exactly or else in part, `ext:` an extension, `hash:` the start of a name hash in hex, `in:` an archive by its name, with or without `.rpf`, or by the end of its path, and `size:>N` and `size:` keeps another such file in the configuration folder, once, for every pack of every install, and every pack then reads through that one. What this section says of supplied tables holds for the tree's file and for one you keep alike, and the screens word both as supplied. +The coder's tables are published as one file of a fixed layout, which `crates/io/or-io/src/gta6/bcpack/supplied/mod.rs` reads. A body of BC1, BC3, BC4, BC5, BC6H or BC7 blocks is rebuilt through the tree's file by default, in place of BC1's built-in tables alone and of any calibration, and the app offers no calibration while tables are active; BC2 uses its own built-in tables. `openrage-cli ttpf tables ` keeps another such file in the configuration folder, once, for every pack of every install, and every pack then reads through that one. What this section says of supplied tables holds for the tree's file and for one you keep alike, and the screens word both as supplied. - **OpenRage ships one such file and vouches for no value of it.** The tree holds the file and nothing computed from it, and whose the tables are is not known ([LICENSE-third-party.md](../../LICENSE-third-party.md)). A file of another length, with other entropy models than the coder's, or that names a BC7 block the lane rules here would not rebuild, is refused by what is wrong with it. A file that reads has a tables file's layout, which says nothing of its values: a kept file is "supplied", and no more. - **A read counts what speaks against the tables.** For each texture `Decode` counts the blocks drawn through a value no table gives, and the BC6H and BC7 blocks no encoder writes: a BC6H end a difference takes out of its base's range, an anchor's index with its top bit set, and two ends of a BC7 subset that disagree on the p-bit they share. No table is fitted to these rules, and tables that are right leave no such block. A BC1, BC3, BC4 or BC5 block has no such rule. @@ -169,27 +169,27 @@ The coder's tables are published as one file of a fixed layout, which `crates/io ### Where no tables file reads: a calibration, which is an estimate -⚠ A pack always reads through a tables file, the tree's or one you keep, so nothing of this section is reached by `load_cache`: it says what BC1's built-in tables and `crates/io/or-io/src/gta6/bcpack/calibrate.rs` do for a caller that hands a pack no tables file. +⚠ A pack always reads through a tables file, the tree's or one you keep, so nothing of this section is reached by `load_cache`: it says what BC1's built-in tables and `crates/io/or-io/src/gta6/bcpack/calibrate/mod.rs` do for a caller that hands a pack no tables file. - **BC1 decodes through its built-in tables, and is not called exact.** The tables come with the port of bcpack-rs, whose author fitted them, and nothing confirms them value for value. A BC1 texture read through them alone is said to rest on the built-in tables, in the list, the inspector, the texture view, `ttpf info` and an export, the app's as the command line's. With a tables file kept, BC1 reads through that file instead, and each read holds the file's BC1 tables against the built-in ones: a block whose chain of references starts at a preset slot the two give differently, or one of whose quadrants carries a symbol they give differently, is counted, and the texture says how many of its blocks read such a value. `ttpf tables --check` counts those blocks over a folder, and `--probe` says how far they are from the plain mips through each of the two tables. Where the two differ is computed from your own file at each read and is nowhere in the tree. One preset slot has no built-in value, and a body that reads it is treated as the modes below are. - **A texture whose coded body was not read is not called exact.** A read stops at the first body that does not read and gives the levels above it. With no tables kept, a BC3, BC4, BC5, BC6H or BC7 texture whose top levels are stored plainly reads those levels and no other: it says that its plain levels were read and its coded levels were not, in the list, the inspector, the texture view, `ttpf info` and an export. With tables kept, a texture whose coded bodies read down to one that does not decode says that a coded body of it was not read, and that only the levels above that body were. -- **BC3, BC4, BC5, BC6H and BC7 decode through tables fitted on the user's machine.** No texture is stored both coded and plain, so `crates/io/or-io/src/gta6/bcpack/calibrate.rs` fits each table against the plain mip levels beside a coded one, over the packs of a folder, in passes. BC6H and BC7 each read two presets, of endpoints and of indices, which `crates/io/or-io/src/gta6/bcpack/bc6h_fit.rs` and `crates/io/or-io/src/gta6/bcpack/bptc_fit.rs` fit. +- **BC3, BC4, BC5, BC6H and BC7 decode through tables fitted on the user's machine.** No texture is stored both coded and plain, so `crates/io/or-io/src/gta6/bcpack/calibrate/mod.rs` fits each table against the plain mip levels beside a coded one, over the packs of a folder, in passes. BC6H and BC7 each read two presets, of endpoints and of indices, which `crates/io/or-io/src/gta6/bcpack/calibrate/bc6h_fit.rs` and `crates/io/or-io/src/gta6/bcpack/calibrate/bptc_fit.rs` fit. - **A texture whose plain levels are not one another averaged down gives no target.** A map filtered anew for each level is such a texture; its coded levels are drawn through what the other textures fit, and vote only what those left open, against the pixels across each block's edges. - **A signed BC6H texture is drawn through the tables the unsigned textures fit.** No signed texture has a plain level beside a coded one, so a calibration reads one only for what needs no target: the range of its ends, read as signed, and the pixels across its blocks' edges. What checks its decode needs no pixel either: an encoder's difference never takes an end out of its base's range, and the blocks of a signed body kept to that through tables fitted without them. **A calibrated texture is an estimate.** It is the picture the fitted tables give, not the picture the game decodes, and it can be wrong in any block drawn through a slot or symbol the fit did not solve. `Decode` counts both: the blocks rebuilt through fitted tables, and those of them drawn through an unsolved slot. The inspector, the Gallery, `ttpf info` and an export each say "calibrated" with that share, and a save never writes an estimate: it carries the coded bodies as the file stores them. -`openrage-cli ttpf calibrate ` and the app's job (`src/state/gta6_bcpack_calibration.rs`) fit the tables and keep them in the configuration folder for the packs they read, under a name the packs' names and lengths give, so a game moved to another folder keeps its calibration. The app offers the calibration in a pack's list while the game has neither a calibration nor supplied tables, until it is done or declined. A run that is stopped or cut short keeps where it stood after each pass, and the next run of the same packs goes on from there. A slot is fitted only from the packs read, so the folder named should hold every pack of the game. The table the command prints says how far each mode's coded mips are from the plain mips beside them, in 8-bit steps and for BC6H in stops, which is the only measure of a fit there is. A pass reads each texture once, on up to 16 threads that each hold one texture; `--coverage` then decodes every coded body of the folder once and counts, by mode, the textures that read with nothing against them, as estimates, or not at all, which takes longer than the fit. +`openrage-cli ttpf calibrate ` and the app's job (`src/state/ttpf_document/calibration.rs`) fit the tables and keep them in the configuration folder for the packs they read, under a name the packs' names and lengths give, so a game moved to another folder keeps its calibration. The app offers the calibration in a pack's list while the game has neither a calibration nor supplied tables, until it is done or declined. A run that is stopped or cut short keeps where it stood after each pass, and the next run of the same packs goes on from there. A slot is fitted only from the packs read, so the folder named should hold every pack of the game. The table the command prints says how far each mode's coded mips are from the plain mips beside them, in 8-bit steps and for BC6H in stops, which is the only measure of a fit there is. A pass reads each texture once, on up to 16 threads that each hold one texture; `--coverage` then decodes every coded body of the folder once and counts, by mode, the textures that read with nothing against them, as estimates, or not at all, which takes longer than the fit. ### A coded texture replaced -A texture stored through the coder that is replaced, from a picture or from a DDS of its blocks, keeps its entry and key, and each of its rows the file stores through the coder is coded through it again where the encoder codes the mode (`crates/io/or-io/src/gta6/ttpf_recode.rs`): BC1 always, BC6H and BC7 through tables the user supplied. The row then keeps its codec and a size near the one the file gave it. Where the encoder does not code the mode (BC3, BC4 and BC5, BC6H and BC7 with no supplied tables, a signed BC6H texture), the row is a zlib stream of its own BC format, a codec the row table states row by row, and the result line says why. `openrage-cli texture replace`, `openrage-cli ttpf replace` and a picture chosen for or dropped on a pack's texture in the app all do it, and the save goes through the archive's row as every edit does. Put back into its archive, the pack goes in as a patched copy only where each changed chunk still fits, which a zlib row of BC blocks, larger than a coded one, seldom does; where one does not, only a rebuilt archive holds it, and the game refuses a rebuilt archive at mount by its table signature. A picture of another size dropped on a coded texture in the app is resampled to the texture's own size and mips, as `texture replace --resize` does; another format or mip count, in the app or through `ttpf replace`, plans its rows anew as zlib streams and moves the textures after it, which only a rebuilt archive holds. Refused by name: a coded cube, array or volume, whose other slices would be kept from a read that is not exact; a picture for BC6H, which has no picture encoder in the tree, where a DDS of its blocks replaces it (`--dds-mips`); and a picture for BC7 in a build without `bc7-encode`. No run of the game was made with a coded texture written either way. +A texture stored through the coder that is replaced, from a picture or from a DDS of its blocks, keeps its entry and key, and each of its rows the file stores through the coder is coded through it again where the encoder codes the mode (`crates/io/or-io/src/gta6/ttpf/write/recode.rs`): BC1 always, BC6H and BC7 through tables the user supplied. The row then keeps its codec and a size near the one the file gave it. Where the encoder does not code the mode (BC3, BC4 and BC5, BC6H and BC7 with no supplied tables, a signed BC6H texture), the row is a zlib stream of its own BC format, a codec the row table states row by row, and the result line says why. `openrage-cli texture replace`, `openrage-cli ttpf replace` and a picture chosen for or dropped on a pack's texture in the app all do it, and the save goes through the archive's row as every edit does. Put back into its archive, the pack goes in as a patched copy only where each changed chunk still fits, which a zlib row of BC blocks, larger than a coded one, seldom does; where one does not, only a rebuilt archive holds it, and the game refuses a rebuilt archive at mount by its table signature. A picture of another size dropped on a coded texture in the app is resampled to the texture's own size and mips, as `texture replace --resize` does; another format or mip count, in the app or through `ttpf replace`, plans its rows anew as zlib streams and moves the textures after it, which only a rebuilt archive holds. Refused by name: a coded cube, array or volume, whose other slices would be kept from a read that is not exact; a picture for BC6H, which has no picture encoder in the tree, where a DDS of its blocks replaces it (`--dds-mips`); and a picture for BC7 in a build without `bc7-encode`. No run of the game was made with a coded texture written either way. ## Names, naming rules and use labels An archive's table names an entry only by a hash, and a pack names no texture. Names come from what the bodies spell. -**The harvest.** `crates/io/or-io/src/gta6/names.rs` reads the start of each body for printable names: the names resources state of themselves and of each other, and plain ones. Each name is hashed both ways, 32-bit and 64-bit (`crates/io/or-io/src/gta6/hash.rs`), into a `Vocabulary` kept in the configuration folder. From then on a hash read anywhere is shown by its name, in the CLI and in the app. The harvest also keeps the name each drawable and fragment states of itself, by its offset, which a scan's list shows beside the row. `openrage-cli rpf scan-names` runs it, and the app runs it as a job (`src/state/gta6_names.rs`, `src/state/gta6_install_harvest.rs`). +**The harvest.** `crates/io/or-io/src/gta6/names/mod.rs` reads the start of each body for printable names: the names resources state of themselves and of each other, and plain ones. Each name is hashed both ways, 32-bit and 64-bit (`crates/io/or-io/src/gta6/hash.rs`), into a `Vocabulary` kept in the configuration folder. From then on a hash read anywhere is shown by its name, in the CLI and in the app. The harvest also keeps the name each drawable and fragment states of itself, by its offset, which a scan's list shows beside the row. `openrage-cli rpf scan-names` runs it, and the app runs it as a job (`src/state/gta6/install/gta6_names.rs`, `src/state/gta6/install/gta6_install_harvest.rs`). **Map names.** A map body states its name as two hashes, and few bodies spell a map's name. The names of the maps that go with a named map follow from it: its occlusion and level-of-detail maps, its instance maps by range and detail, numbered from 0, and its area's imposter maps (`crates/io/or-io/src/gta6/map_names.rs`). As with a texture, a rule makes candidates and a candidate names a map only where it hashes to the 64-bit word a body states. `rpf scan-maps` ends with how many maps, archetypes and entities the kept names name and how many maps more the rules name, beside the same count from the names reversed, which is what chance gives; `--names` keeps the names the rules gave with the others. @@ -199,7 +199,7 @@ An archive's table names an entry only by a hash, and a pack names no texture. N **The naming rules.** A texture's name follows from the name of the drawable that uses it: the drawable's stem, then a map kind, a level-of-detail token swapped, a numbered variant, the stem's first or last tokens, or a ped component's pattern (`Rule` in `crates/io/or-io/src/gta6/texture_names.rs`). The rules make candidates, and a candidate names a key only where it hashes to one, so a rule can miss and cannot name wrongly short of a hash collision. Nothing there is a list of names. A file of names the user picks is read the same way. -**The rules of `hashes mine`.** Past the strings it reads, `hashes mine` runs named rules over the names its tables already have and what its bodies state (`crates/tools/or-cli/src/gta6/names_mine/named.rs`). A speech container is named after a line label a conversation body states, without its take number; a conversation body after a label's stem with the ending a named one adds to its keys; a text table after a dialogue key without its line code. Then the numbering of named siblings is filled in, one or two tokens are swapped among them, character kits and recordings are made of label tokens, a cell is met in the middle by its 32-bit name, a prop set takes a prefix its named siblings share and a model another table names, and the texts audio game data states are cut as the labels are. The bodies are a few leaves of every table and every leaf of a table where one of them states dialogue or audio game data. Each rule is bounded in candidates and in time and reports its candidates, the names it found and its seconds; `hashes mine --rule ` runs one alone. A candidate names an entry only where its hash is that entry's, and where the row states a 32-bit name, that one too. +**The rules of `hashes mine`.** Past the strings it reads, `hashes mine` runs named rules over the names its tables already have and what its bodies state (`crates/tools/or-cli/src/gta6/names_mine/named/mod.rs`). A speech container is named after a line label a conversation body states, without its take number; a conversation body after a label's stem with the ending a named one adds to its keys; a text table after a dialogue key without its line code. Then the numbering of named siblings is filled in, one or two tokens are swapped among them, character kits and recordings are made of label tokens, a cell is met in the middle by its 32-bit name, a prop set takes a prefix its named siblings share and a model another table names, and the texts audio game data states are cut as the labels are. The bodies are a few leaves of every table and every leaf of a table where one of them states dialogue or audio game data. Each rule is bounded in candidates and in time and reports its candidates, the names it found and its seconds; `hashes mine --rule ` runs one alone. A candidate names an entry only where its hash is that entry's, and where the row states a 32-bit name, that one too. **The use label.** A texture no name is found for is still used: the harvest records, for each texture key a model's material binds, the first model that binds it, the shader parameter that binds it there, and how many models bind it. The label is that model and parameter, as in "used by a model as its diffuse texture, and by two models more". It is not a name, since it hashes to no key; it tells a person what a nameless texture is for, and the pack's list filters by it. @@ -211,9 +211,9 @@ GTA VI's Xbox programs ship as native GPU code with no bitcode. Two front ends i - `rdna` reads native code: `crates/tools/or-shader-front/src/rdna/decode.rs` decodes the instruction words, `crates/tools/or-shader-front/src/rdna/cfg.rs` cuts them into a control-flow graph, `crates/tools/or-shader-front/src/rdna/sym.rs` follows where each scalar register's value came from, which is the only way a program names its resources, and `crates/tools/or-shader-front/src/rdna/to_naga/mod.rs` lowers a pixel, vertex, mesh or compute program to a module. Everything it does not model is refused by name (`NotTranslated`). - `crates/tools/or-shader-front/src/rdna_bind/mod.rs` joins each resource of a translated module to the binding record its package lists and to the name the effect container's table gives that register, and refuses, by name (`Unbound`), a program the renderer has nothing to give: one that fetches its vertices from buffers the game fills, reads numbers the game passes with each draw, or picks a resource by a number the game sets. -The app translates the vertex and pixel programs a drawable's effects run, on a worker, once a session, into a pack held in memory (`src/state/gta6_shaders.rs`), and Shaded draws a pass only when both its programs translate and bind (`src/render/gta6_shaded.rs`). The Shaded button says how many programs of the drawable's passes are refused and why the first is. The other shading modes need no program. +The app translates the vertex and pixel programs a drawable's effects run, on a worker, once a session, into a pack held in memory (`src/state/gta6/drawable/gta6_shaders/mod.rs`), and Shaded draws a pass only when both its programs translate and bind (`src/render/gta6_shaded.rs`). The Shaded button says how many programs of the drawable's passes are refused and why the first is. The other shading modes need no program. -The light of Shaded follows the install where its common archive is found: `src/state/gta6_timecycle.rs` reads the time table and the weather cycles among that archive's XML bodies with GTA V's reader, and `src/render/viewport/gta6_day.rs` puts the sun and the moon where the hour puts them, lets one of them light as their heights say, and takes the two samples of the weather's cycle that stand for the sun's angle. The cycle states the light's illuminance, its fade, its colour and what multiplies the sky's ambient; the Shaded line says when a model is lit this way. ⚠ Two things are still the editor's own: the exposure, which the game meters from each frame on the GPU, stands as one constant for sunlight and one for moonlight, and the colour of the sky and of the ground is the built-in sky's, since the game computes it from its atmosphere. What a surface makes of that light is the game's own arithmetic and no port of it: the full-screen programs of its tiled lighting, one for each kind of material a frame's targets hold (the standard one for a kind with none of its own), are translated, bound to those targets and drawn into the lit frame (`crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_light.rs`, handed by `src/render/gta6_frame_light.rs`), with the two tables they read baked by the game's own programs. Until a model's passes are built, or where a device refuses them, the model is drawn as Material and the Shaded line says which. What those programs are handed is still the editor's: the light from all around on each pixel (a probe's nine numbers, and a studio to mirror for a photograph; `crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_around.rs`), the sun's shadow's map, one tile fitted to the model, and the ground under a model as a surface in the targets. The sun's mask is the game's own program's: the compute program that resolves its cascades takes each pixel to that map, compares, searches for what stands before the pixel and filters, and writes the root of the share of the light that arrives, which the lighting programs read, with the words that tell them where to rebuild a pixel's share from those about it (`crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_shadow.rs`). It is handed the editor's one tile as each of its four cascades, the numbers the install's tuning values state, a constant bias and a reach of the filter that follow from the tile's own depth, and a noise that is a plain hash where the game's is a blue noise; the shadow the game marches through the screen after it is left at rest, since what it multiplies its opacities by is not read. How open each pixel is to that light is the game's own program's too: its occlusion pass takes eight taps of the depth about a pixel and writes the way most of the sky is seen along, which the lighting programs read to dim what a glossy surface mirrors, with the numbers the install's tuning values state (`crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_cones.rs`); the noise it turns its taps by is the editor's, a plain hash where the game's is a blue noise. The lit frame is metered, exposed and toned by the game's own programs as well: the three compute programs that take the frame's least and greatest luminance, the two of its luminance histogram, the pass that works out the stops a frame is exposed by and the pass of its tone curve, each translated and handed the constants a cycle and the install's tuning values state (`crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_tone.rs`). A model stands alone in its frame, so the editor counts the pixels nothing covers and has the meter leave them out with the darkest (`crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_covered.rs`): the frame is exposed for its surfaces, the ground under the model among them. +The light of Shaded follows the install where its common archive is found: `src/state/gta6/drawable/gta6_shaders/timecycle.rs` reads the time table and the weather cycles among that archive's XML bodies with GTA V's reader, and `src/render/viewport/gta6_day.rs` puts the sun and the moon where the hour puts them, lets one of them light as their heights say, and takes the two samples of the weather's cycle that stand for the sun's angle. The cycle states the light's illuminance, its fade, its colour and what multiplies the sky's ambient; the Shaded line says when a model is lit this way. ⚠ Two things are still the editor's own: the exposure, which the game meters from each frame on the GPU, stands as one constant for sunlight and one for moonlight, and the colour of the sky and of the ground is the built-in sky's, since the game computes it from its atmosphere. What a surface makes of that light is the game's own arithmetic and no port of it: the full-screen programs of its tiled lighting, one for each kind of material a frame's targets hold (the standard one for a kind with none of its own), are translated, bound to those targets and drawn into the lit frame (`crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_light.rs`, handed by `src/render/gta6_frame_light.rs`), with the two tables they read baked by the game's own programs. Until a model's passes are built, or where a device refuses them, the model is drawn as Material and the Shaded line says which. What those programs are handed is still the editor's: the light from all around on each pixel (a probe's nine numbers, and a studio to mirror for a photograph; `crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_around.rs`), the sun's shadow's map, one tile fitted to the model, and the ground under a model as a surface in the targets. The sun's mask is the game's own program's: the compute program that resolves its cascades takes each pixel to that map, compares, searches for what stands before the pixel and filters, and writes the root of the share of the light that arrives, which the lighting programs read, with the words that tell them where to rebuild a pixel's share from those about it (`crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_shadow.rs`). It is handed the editor's one tile as each of its four cascades, the numbers the install's tuning values state, a constant bias and a reach of the filter that follow from the tile's own depth, and a noise that is a plain hash where the game's is a blue noise; the shadow the game marches through the screen after it is left at rest, since what it multiplies its opacities by is not read. How open each pixel is to that light is the game's own program's too: its occlusion pass takes eight taps of the depth about a pixel and writes the way most of the sky is seen along, which the lighting programs read to dim what a glossy surface mirrors, with the numbers the install's tuning values state (`crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_cones.rs`); the noise it turns its taps by is the editor's, a plain hash where the game's is a blue noise. The lit frame is metered, exposed and toned by the game's own programs as well: the three compute programs that take the frame's least and greatest luminance, the two of its luminance histogram, the pass that works out the stops a frame is exposed by and the pass of its tone curve, each translated and handed the constants a cycle and the install's tuning values state (`crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_tone.rs`). A model stands alone in its frame, so the editor counts the pixels nothing covers and has the meter leave them out with the darkest (`crates/runtime/or-renderer/src/game_shaders/geometry/meshlets/frame_covered.rs`): the frame is exposed for its surfaces, the ground under the model among them. The sun's shadow on a GTA VI model in Shaded is the model's own, cast into one tile fitted to it by the mesh stages its programs draw with (`or_renderer::game_shaders::meshlets`). ⚠ What that shadow is today: every surface those programs draw casts whole, so an alpha-tested surface (leaves, a fence, hair cards) casts the shadow of its whole geometry, holes included, because the pass that casts runs a surface's mesh stage and no pixel stage; a surface drawn as Material beside the others casts none; and a model one of whose surfaces reads the view at an offset the light's view cannot be copied to casts none at all, which the Shaded line then says. A surface that faces away from the light takes none of it, as the game's program has it. @@ -259,13 +259,13 @@ Measured on the `shaders.rpf` of build 1.0.2.1 on 2026-11-27, at `cb55fc42`, on ## Saves and mission tables -`crates/io/or-io/src/gta6/save.rs` knows three containers. A story save is an index over one JSON text; it opens as an owned value, a value is read or replaced by a path of steps, and it saves. A record is a header before a payload and is read. A packed copy's clear head is read and its body refused. +`crates/io/or-io/src/gta6/save/mod.rs` knows three containers. A story save is an index over one JSON text; it opens as an owned value, a value is read or replaced by a path of steps, and it saves. A record is a header before a payload and is read. A packed copy's clear head is read and its body refused. ⚠ **The save reader was written from a description of the layout alone.** Where its comments say "measured", the measurement is the description's, not OpenRage's. Its own tests build their saves by hand from the same description; only the story-save tests below open a real save. -A console story save is a version folder holding `0`, `1` and `manifest`. File `0` is an ASAV header, the `JSAV` compressed with LZ4, padded and enciphered, then a clear HMAC-SHA-256 tag over both; file `1` states file `0`'s size, hash and sizes under a checksum of its own. `crates/io/or-io/src/gta6/save_codec.rs` opens file `0` with the cipher read from the user's `game_scarlett_master.exe`, refuses a bad header checksum or tag, and writes both files back. `crates/io/or-io/src/gta6/save_stats.rs` reads the statistics block as stats keyed by name, sub name and context, and reads only: the game loads a save whose statistics values were edited with every stat reset, so `gta6-save set` refuses that block. The same pipeline, run by a research tool, wrote saves the game loaded; a save OpenRage itself wrote has not been loaded yet. The real-save tests run with `OPENRAGE_GTA6_EXE` and `OPENRAGE_GTA6_STORY_SAVE` (a version folder) set. +A console story save is a version folder holding `0`, `1` and `manifest`. File `0` is an ASAV header, the `JSAV` compressed with LZ4, padded and enciphered, then a clear HMAC-SHA-256 tag over both; file `1` states file `0`'s size, hash and sizes under a checksum of its own. `crates/io/or-io/src/gta6/save/codec/mod.rs` opens file `0` with the cipher read from the user's `game_scarlett_master.exe`, refuses a bad header checksum or tag, and writes both files back. `crates/io/or-io/src/gta6/save/stats/mod.rs` reads the statistics block as stats keyed by name, sub name and context, and reads only: the game loads a save whose statistics values were edited with every stat reset, so `gta6-save set` refuses that block. The same pipeline, run by a research tool, wrote saves the game loaded; a save OpenRage itself wrote has not been loaded yet. The real-save tests run with `OPENRAGE_GTA6_EXE` and `OPENRAGE_GTA6_STORY_SAVE` (a version folder) set. -`crates/io/or-io/src/gta6/save_story.rs` reads and edits what the story blocks state about the players, and every edit replaces or adds only the values it names. +`crates/io/or-io/src/gta6/save/story/mod.rs` reads and edits what the story blocks state about the players, and every edit replaces or adds only the values it names. - **Items and cash.** The inventory block is one record for each owner. An item names its parent by an index into its record's list of parent ids, and the record lists a code for each row, so an added item writes all three; an item with a wrong parent index is ignored by the game. Cash is an item whose count is dollars. A wallet pocket holds up to 20,000; the BuckMe account and the BuckMe savings are pockets under two containers, and each cash slot has a cap the running game states. - **Unlocks.** The unlock block is a list of hashes with a state beside each, 9 off and 15 on. Unlock `0x35FBEA7B` is the BuckMe freeze: the app shows the account frozen while it is on, so an edit that turns every unlock on freezes the account. @@ -275,15 +275,15 @@ A console story save is a version folder holding `0`, `1` and `manifest`. File ` **In the app**, a console story save's file `0` opens as the story it holds (`src/ui/panels/hierarchy/gta6/save.rs`). It is deciphered with the executable of the GTA VI install folder set in Settings, or of `OPENRAGE_GTA6_EXE`; with neither it opens as a record, read only, and says what to set. The outline edits every value as it does a plain story save's. The facts pane (`src/ui/panels/hierarchy/gta6/save_players.rs`) edits what a path alone cannot, each edit a step of undo: the cash of every measured place of each inventory record, typed as an amount, where a place the record has no pocket for gets its pocket with the cash; every cash slot at its cap; any unlock on or off, from a list filtered by hash, the BuckMe freeze among them; a character's flags; each physique level; content hashes counted as completed in a group; and a name or hash listed in a discovery category. A save writes file `0` back under its own header and tag, and restates file `1` where it lies beside a file named `0`; `manifest` is left as it is. "Write as the slot of another save…" takes the header of another console save's file `0`, so the story then saves as that slot, into a version folder of it; that is no step of undo. The lists of what to complete or discover are not in OpenRage: the hashes are typed or pasted. The app's open path was run on a real save by its tests; the game has not loaded a file the app wrote. -The mission state tables are the opposite case. An inflated body of a script archive is a metadata document in the table form, and a state table is one of its blocks, found by the body's own block table and type table and never by a scan of its bytes (`crates/io/or-io/src/gta6/mission_tables.rs`). They are read only: what orders the states is not proven. +The mission state tables are the opposite case. An inflated body of a script archive is a metadata document in the table form, and a state table is one of its blocks, found by the body's own block table and type table and never by a scan of its bytes (`crates/io/or-io/src/gta6/mission_tables/mod.rs`). They are read only: what orders the states is not proven. ## Text, radio and dialogue -A text table is a map from a label's hash to one text or to the grammatical variants of one. A written table opens as the same table and is not byte-identical to the game's, because the layout the game's writer chose is not known. A table states no language: `crates/io/or-io/src/gta6/text_language.rs` takes it from the order in which a change set registers the text archives, which holds only while the file holds as many as are registered. +A text table is a map from a label's hash to one text or to the grammatical variants of one. A written table opens as the same table and is not byte-identical to the game's, because the layout the game's writer chose is not known. A table states no language: `crates/io/or-io/src/gta6/text_language/mod.rs` takes it from the order in which a change set registers the text archives, which holds only while the file holds as many as are registered. -From a text table's Inspector every text table of its install is searched in every language, as a job the list shows and stops (`src/state/gta6_modding/text_search.rs`): a key is found by its label, its hash or words of one of its texts, case and accents ignored, and shown with a line per language, the language named by its archive's name, else by the one registered in its place, else by its place. A line's text edits there, and the edits save each into its own row, one new copy per archive: a patched copy where every table still fits its row, else a rebuilt archive, which the game refuses. A key added to or removed from a table goes where the game's linear probing puts and finds it; the table is then laid out again within its section's length where it fits, so its row keeps its size and a patched copy can still take it, else at the length it needs, so its row grows and the save ends in a rebuilt archive. +From a text table's Inspector every text table of its install is searched in every language, as a job the list shows and stops (`src/state/gta6/modding/text_search/mod.rs`): a key is found by its label, its hash or words of one of its texts, case and accents ignored, and shown with a line per language, the language named by its archive's name, else by the one registered in its place, else by its place. A line's text edits there, and the edits save each into its own row, one new copy per archive: a patched copy where every table still fits its row, else a rebuilt archive, which the game refuses. A key added to or removed from a table goes where the game's linear probing puts and finds it; the table is then laid out again within its section's length where it fits, so its row keeps its size and a patched copy can still take it, else at the length it needs, so its row grows and the save ends in a rebuilt archive. -Radio and dialogue are joins across bodies, all read only. A station names track lists, a track names a streamed sound by key, and a streamed sound names its audio streams (`crates/io/or-io/src/gta6/audio_radio.rs`). A dialogue line's label is its key in the text tables and its place among a key's labels numbers its audio stream (`crates/io/or-io/src/gta6/dialogue.rs`); the pairs are found by their shape in a body's bytes, not through the body's structure, and a line's number is settled from the streams that exist. `src/state/gta6_dialogue.rs` indexes the open scans so that a line plays with its subtitle in the language picked. +Radio and dialogue are joins across bodies, all read only. A station names track lists, a track names a streamed sound by key, and a streamed sound names its audio streams (`crates/io/or-io/src/gta6/audio/radio/mod.rs`). A dialogue line's label is its key in the text tables and its place among a key's labels numbers its audio stream (`crates/io/or-io/src/gta6/dialogue/mod.rs`); the pairs are found by their shape in a body's bytes, not through the body's structure, and a line's number is settled from the streams that exist. `src/state/gta6/audio/gta6_dialogue/mod.rs` indexes the open scans so that a line plays with its subtitle in the language picked. ## What was checked against a build diff --git a/docs/features/GTA_VI_Mods.md b/docs/features/GTA_VI_Mods.md index db412b504..551605593 100644 --- a/docs/features/GTA_VI_Mods.md +++ b/docs/features/GTA_VI_Mods.md @@ -2,7 +2,7 @@ How a GTA VI mod package is made, checked, installed into an install, put in another order and taken out again, what an install that is stopped half way leaves and how the next run repairs it, and what is refused. -The code is `crates/domain/or-project/src/gta6_mod.rs`; the `gta6 mod` verbs are `crates/tools/or-cli/src/gta6/package.rs`, and the app's part is the Mods panel (`src/ui/panels/mods_gta6.rs`, `src/state/gta6_modding/mod_package.rs`, `src/state/gta6_modding/mod_package_install.rs`). What this page says an install does was watched on 2026-11-29 in a rehearsal over copies of a build's archives in a scratch folder, described [at its end](#how-this-was-checked). +The code is `crates/domain/or-project/src/gta6_mod.rs`; the `gta6 mod` verbs are `crates/tools/or-cli/src/gta6/package.rs`, and the app's part is the Mods panel (`src/ui/panels/mods_gta6.rs`, `src/state/gta6/modding/mod_package/mod.rs`, `src/state/gta6/modding/mod_package_install/mod.rs`). What this page says an install does was watched on 2026-11-29 in a rehearsal over copies of a build's archives in a scratch folder, described [at its end](#how-this-was-checked). ⚠ **Every archive an install puts in place is a patched copy**, and nothing else. Its bodies are changed chunk by chunk and every header, table and names span of every archive in it, nested ones included, stays byte-identical to the original's, so the signature the game checks over the table still matches, and no check read in the game's code rejects one. OpenRage has made no run of the game with a patched copy, so whether the game loads one is not known, and every verb and the app's question say so. A body that does not fit its row is refused rather than written into a rebuilt archive, because the game refuses a rebuilt archive: only its maker can sign the table. [GTA_VI_Builds.md](GTA_VI_Builds.md#a-patched-copy) says what a patched copy is and what was checked of it. diff --git a/docs/features/GTA_VI_World_Viewer.md b/docs/features/GTA_VI_World_Viewer.md index 02122adcc..3c6a2fbde 100644 --- a/docs/features/GTA_VI_World_Viewer.md +++ b/docs/features/GTA_VI_World_Viewer.md @@ -91,8 +91,8 @@ hours it states. ## Streaming and level of detail `crates/domain/or-world/src/streaming.rs` holds the rules, with no file or device in them, and -`crates/domain/or-world-gta6/src/stream.rs` streams the maps and selects what draws by them, on a -thread of its own (`crates/domain/or-world-gta6/src/stream_world.rs`): +`crates/domain/or-world-gta6/src/stream/mod.rs` streams the maps and selects what draws by them, on a +thread of its own (`crates/domain/or-world-gta6/src/stream/world.rs`): - A map is wanted while the camera is within the sphere of the box it streams by: about the box's middle, of the box's smallest half extent and 50 m; a box under a metre of half extent on any @@ -184,7 +184,7 @@ change): run the World screen with `just dev-fast`. them. - A fading instance is drawn through an ordered dither. - No far stand-in's card is drawn. Which species each stand-in names is still worked out at index - build (`crates/domain/or-world-gta6/src/stream_slod.rs`), and the reference digests count it. + build (`crates/domain/or-world-gta6/src/stream/slod.rs`), and the reference digests count it. Models are read on workers in the game's order: what waits for them in view first, then far levels, interiors and the rest, and the nearest first within each; textures as the models that draw ask for diff --git a/docs/guides/Development_Workflow.md b/docs/guides/Development_Workflow.md index 4967072a9..ec5433ff2 100644 --- a/docs/guides/Development_Workflow.md +++ b/docs/guides/Development_Workflow.md @@ -672,7 +672,7 @@ OPENRAGE_GTA6_WORLD_DIGESTS_WRITE=REFERENCE.txt cargo nextest run --profile all OPENRAGE_GTA6_WORLD_DIGESTS=REFERENCE.txt cargo nextest run --profile all -p openrage --bin openrage -E 'test(the_world_reads_as_its_reference_says)' ``` -The suite is `src/state/gta6_worldview/reference_tests.rs`, of the slow tier. It builds the +The suite is `src/state/gta6/world/gta6_world/worldview/reference/mod.rs`, of the slow tier. It builds the install's index afresh, or, with `OPENRAGE_GTA6_WORLD_INDEX_KEPT` naming a folder, opens it through the file kept there as a start of the viewer does, so that a second run with the same folder holds the index read back, and says what the kept file served. It digests each of the diff --git a/docs/guides/Documentation_Standard.md b/docs/guides/Documentation_Standard.md index 3aade1d3e..e55ae2ccb 100644 --- a/docs/guides/Documentation_Standard.md +++ b/docs/guides/Documentation_Standard.md @@ -196,7 +196,7 @@ the rest of that file. It splits the text on single backticks and skips a token that spans a line or holds a space, wildcard or bracket, so an inline triple backtick leaves every later citation unchecked while the gate passes. -`src/repo_tests/shell_budget.rs`, `src/repo_tests/suppressions.rs`, `src/state/tests.rs` and +`src/repo_tests/shell_budget.rs`, `src/repo_tests/suppressions.rs`, `src/state/tests/mod.rs` and `the_shell_is_flat_rather_than_deep` hold what [Crate_Reference.md](../reference/Crate_Reference.md) argues about the shell (a code-line budget per file in `src/`, a reason beside every suppression that hides unused code or covers a module, a flat `AppState` diff --git a/docs/guides/Licence_And_Provenance_Policy.md b/docs/guides/Licence_And_Provenance_Policy.md index c00fb4d5e..5f68e1e4e 100644 --- a/docs/guides/Licence_And_Provenance_Policy.md +++ b/docs/guides/Licence_And_Provenance_Policy.md @@ -101,9 +101,9 @@ measurement behind each. Measure and write the test before opening a reference. | The public GTA V script decompilers: `njames93/GTA-V-Script-Decompiler`, its fork `maybegreat48/GTA-V-Script-Decompiler`, and `Jaycadox/ysc-utils` | none: GitHub reports no licence for any of the three (checked 2026-10-03), so all rights are reserved | Inspiration for algorithms only, which copyright does not cover. Nothing was copied from any of them into `crates/io/or-io/src/gta5/script/decompile/`: no code, no names, no comments and no tables; the decompiler lifts the stack code and structures the control-flow graph by methods of its own ([R63](../direction/Roadmap.md#r63-the-script-disassembler-and-the-natives-database)) | | The natives database: `alloc8or/gta5-nativedb-data` (`natives.json`, `natives_gen9.json`) and the crossmap `CSY0N/GTA-V-Crossmaps`'s `Enhanced Crossmap.h` | none: alloc8or's README says "strictly for educational purposes", and GitHub reports no licence for either repository (checked 2026-10-03) | Nothing enters the tree. The `.ysc` inspector and `openrage-cli script download-natives` fetch the files from their repositories into the user's configuration directory only when the user asks, recording each upstream commit, and never in a test; tests use small synthetic lists (owner, 2026-10-03, [R63](../direction/Roadmap.md#r63-the-script-disassembler-and-the-natives-database)) | | bcpack-rs | `MIT OR Apache-2.0`, © 2026 Ahmet Dedeler; its entropy lanes port Microsoft's silicon-rans, MIT | Code, taken under MIT: the entropy layer and the BC1 mode of the coder GTA VI's texture packs store bodies through, in `crates/io/or-io/src/gta6/bcpack/`, each file with the header it asks a port to keep and both notices in `LICENSE-third-party.md`. The tables of the other modes come from a tables file (the next row), the tree's or one a user supplies; tables fitted on the user's machine from the user's own packs are not committed | -| VIctory (`Marvisak/VIctory`) and xcl (`ivall/xcl`), two runtimes for the GTA VI build | VIctory is GPL-3.0-or-later; it carries a file of the BCPack coder's tables that its own policy sets outside its licence, and says nowhere where the bytes come from. xcl is GPL-2.0-only as a whole; it holds a port of VIctory's coder, by its own statement with that author's permission, and the same tables as generated source (both read 2026-11-24) | Facts, each with a measurement of ours behind it, and nothing else: the layout of a tables file, fact by fact as `LICENSE-third-party.md` lists them, which `crates/io/or-io/src/gta6/bcpack/supplied.rs` reads. The two disagree on where a BC7 entry's indices start, and a measurement on packs settled it. Their code, names, comments and code structure are not to be taken: two reviews of the reader against both sources (2026-11-24 and 2026-11-25) found no value of the tables and no translated function; they found passages that followed VIctory's wording or shape, which were rewritten from OpenRage's own measurement notes, and a list computed from a published file's values, which was taken out. **The tables file is in the tree**, as `crates/io/or-io/data/bcpack-tables.bin`, VIctory's file byte for byte, by the owner's ruling of 2026-11-27, with whose the tables are still not known. **Nothing computed from its values is**: where a tables file and bcpack-rs's built-in BC1 tables differ is computed on the user's machine at each read, a user may supply another file to `openrage-cli ttpf tables`, which keeps it in the configuration directory as a calibration is kept, and every test but the one that reads the tree's file uses made-up tables | +| VIctory (`Marvisak/VIctory`) and xcl (`ivall/xcl`), two runtimes for the GTA VI build | VIctory is GPL-3.0-or-later; it carries a file of the BCPack coder's tables that its own policy sets outside its licence, and says nowhere where the bytes come from. xcl is GPL-2.0-only as a whole; it holds a port of VIctory's coder, by its own statement with that author's permission, and the same tables as generated source (both read 2026-11-24) | Facts, each with a measurement of ours behind it, and nothing else: the layout of a tables file, fact by fact as `LICENSE-third-party.md` lists them, which `crates/io/or-io/src/gta6/bcpack/supplied/mod.rs` reads. The two disagree on where a BC7 entry's indices start, and a measurement on packs settled it. Their code, names, comments and code structure are not to be taken: two reviews of the reader against both sources (2026-11-24 and 2026-11-25) found no value of the tables and no translated function; they found passages that followed VIctory's wording or shape, which were rewritten from OpenRage's own measurement notes, and a list computed from a published file's values, which was taken out. **The tables file is in the tree**, as `crates/io/or-io/data/bcpack-tables.bin`, VIctory's file byte for byte, by the owner's ruling of 2026-11-27, with whose the tables are still not known. **Nothing computed from its values is**: where a tables file and bcpack-rs's built-in BC1 tables differ is computed on the user's machine at each read, a user may supply another file to `openrage-cli ttpf tables`, which keeps it in the configuration directory as a calibration is kept, and every test but the one that reads the tree's file uses made-up tables | | Mesa's ACO compiler and AMD's machine-readable instruction description | MIT, © 2018 Valve Corporation; MIT, © 2026 Advanced Micro Devices | The opcode numbers and mnemonics of `crates/tools/or-shader-front/src/rdna/opcodes.rs`, generated from ACO's table and corrected against AMD's description, which is not in the tree; the notice is in `LICENSE-third-party.md`. The decoder and the lowering are OpenRage's own | -| Leonida and other published notes on the GTA VI build | Leonida is GPL-3.0 | Prior art read for facts only, from its documentation and never its code: no code, names, comments or tables. The coder's lane widths of the modes other than BC1 come from it, and a pack's bodies decode by them or do not. ⚠ The save containers of `crates/io/or-io/src/gta6/save.rs` were laid out from published notes with no save to measure, which rule 2 does not let stand as a layout: they are stated as unverified in [GTA_VI_Builds.md](../features/GTA_VI_Builds.md#saves-and-mission-tables) until a save is measured | +| Leonida and other published notes on the GTA VI build | Leonida is GPL-3.0 | Prior art read for facts only, from its documentation and never its code: no code, names, comments or tables. The coder's lane widths of the modes other than BC1 come from it, and a pack's bodies decode by them or do not. ⚠ The save containers of `crates/io/or-io/src/gta6/save/mod.rs` were laid out from published notes with no save to measure, which rule 2 does not let stand as a layout: they are stated as unverified in [GTA_VI_Builds.md](../features/GTA_VI_Builds.md#saves-and-mission-tables) until a save is measured | | GTAMods wiki | public documentation | Facts, cited by page | | Game files from the user's install | Take-Two's | Measure freely, commit never. Parsers read the user's install and bundle no fallback | diff --git a/docs/reference/Crate_Reference.md b/docs/reference/Crate_Reference.md index b18ab5d57..69616a094 100644 --- a/docs/reference/Crate_Reference.md +++ b/docs/reference/Crate_Reference.md @@ -53,7 +53,7 @@ lists the edges. keys of its project file and for the plan, the build and the clean of the Project workspace, where the CLI reads it for `openrage-cli project`. The app and `openrage-cli` both depend on `or-source`: `src/state/workbench/cook.rs` - recooks a saved source with it, `src/state/workbench/scan.rs` finds the source + recooks a saved source with it, `src/state/workbench/scan/mod.rs` finds the source folders with it, `src/state/workbench/build_cooker.rs` and `openrage-cli project build` hand a build the cook (`or_source::cook::cook_source`) and what each folder cooks to (`or_source::cook::describe`), and `crates/tools/or-cli/src/import.rs` makes sources of game @@ -1268,7 +1268,7 @@ the frame cap); grass and prop lists; a time archetype's hours; an interior's entity sets; whether an archetype's asset is a drawable or a fragment, which the index does not keep; and a request by name for `world select`. World is still a workspace shown while a GTA VI folder is set, with one viewer -(`src/state/gta6_worldview/mod.rs`), and the Map screen draws boxes, a scanned +(`src/state/gta6/world/gta6_world/worldview/mod.rs`), and the Map screen draws boxes, a scanned GTA VI map body too. ⚠ A declared `drawableDictionary` outranks a loose file of the same stem, and @@ -1701,13 +1701,13 @@ behaviour ([R71b](../direction/Roadmap.md#r71b-the-gta-vi-world-behind-the-contr part): it states no title yet, and `or-worlds` lists none for it. `index` is the index of an install the World screen streams from (`WorldIndex`: the maps each pack registers with their boxes, each archetype by its word, where each model's body lies), with what the core's kept file holds of it -(`crates/domain/or-world-gta6/src/index_install.rs`, `crates/domain/or-world-gta6/src/index_rows.rs` -and `crates/domain/or-world-gta6/src/index_open.rs`), the mount binding that reads the registration -documents (`crates/domain/or-world-gta6/src/index_mount.rs`), the scan of an archive -(`crates/domain/or-world-gta6/src/index_scan.rs`) and the world states -(`crates/domain/or-world-gta6/src/index_states.rs`). ⚠ `index::open` and `index::build` are handed the key snapshot, +(`crates/domain/or-world-gta6/src/index/install.rs`, `crates/domain/or-world-gta6/src/index/rows.rs` +and `crates/domain/or-world-gta6/src/index/open/mod.rs`), the mount binding that reads the registration +documents (`crates/domain/or-world-gta6/src/index/mount/mod.rs`), the scan of an archive +(`crates/domain/or-world-gta6/src/index/scan.rs`) and the world states +(`crates/domain/or-world-gta6/src/index/states/mod.rs`). ⚠ `index::open` and `index::build` are handed the key snapshot, and `index::open` and `index::keys` the configuration folder: the crate takes neither from the app, and -`src/state/gta6_worldview/index.rs` is where the app gives its own. `occluders` streams +`src/state/gta6/world/gta6_world/worldview/index.rs` is where the app gives its own. `occluders` streams the occluders of the maps near a view through the core's `Pool`; `material` is a model's material record (`CpuMaterial`); and `ambient` holds the ambient scales of an interior, by which the streaming tells indoors from outdoors. The feature `made-up` builds @@ -1719,7 +1719,7 @@ What [R71b](../direction/Roadmap.md#r71b-the-gta-vi-world-behind-the-contract)'s document. The move changed no behaviour: the tests of the moved files run in their new crates, changed in imports alone, and `the_world_reads_as_its_reference_says` held after it to the digests written before it, and failed with the key snapshot kept from `index::build`. The app keeps -`src/state/gta6_worldview/index.rs` (the configuration folder and key snapshot it opens with, +`src/state/gta6/world/gta6_world/worldview/index.rs` (the configuration folder and key snapshot it opens with, and `land_and_water`) and every file of the viewer that names the renderer or the app. ⚠ A line a moved file logs below an error no longer reaches the terminal, and one below `info` no longer reaches the Log panel: both are filtered by crate (`src/diagnostics/mod.rs`). Left: the rest of part 4 and part 5; @@ -1746,7 +1746,7 @@ every archive and keeps nothing. was not read. An archive that changed is read again and no other is (`a_changed_archive_alone_is_read_again`). - **How an archive is read.** Where the key snapshot opens its tables of contents an archive is - read through them (`scan_by_table` of `crates/domain/or-world-gta6/src/index_scan_table.rs`): + read through them (`scan_by_table` of `crates/domain/or-world-gta6/src/index/scan_table/mod.rs`): the table of every nested archive is listed, a map, a map-types body and a dictionary are read where their rows place them, a run of rows a thread, and a drawable or a fragment is taken from its row's name, which is the word its body states, with no byte of it read. An archive with no @@ -1808,18 +1808,18 @@ built afresh, on a machine other lanes were building on. [R71b](../direction/Roadmap.md#r71b-the-gta-vi-world-behind-the-contract) moved the selecting half of the viewer and rewrote none of it. -- **What moved.** `stream` (`crates/domain/or-world-gta6/src/stream.rs`: `Streamer`, the maps +- **What moved.** `stream` (`crates/domain/or-world-gta6/src/stream/mod.rs`: `Streamer`, the maps around a camera and the selection of what draws, `select_asking`) with its child modules: the read of a map body, the far stand-ins, the census, grass, and `World`, the world's own thread - (`crates/domain/or-world-gta6/src/stream_world.rs`); `interior` and `interior_rooms`, the + (`crates/domain/or-world-gta6/src/stream/world.rs`); `interior` and `interior_rooms`, the interiors a map places and the walk through their rooms; `ambient`, the two ambient scales an instance states, which `or-renderer` now takes from the adapter and names again as its own; and `streaming_rules`, the rules read from the build. The core keeps in `crates/domain/or-world/src/streaming_rules.rs` what its forest and its portal walk call (`map_streaming_sphere`, `distance_alpha` and the constants they and the walk read), and the adapter's module names those again beside its own. -- **What the app keeps.** `src/state/gta6_worldview/stream_grass.rs` is the one method of the - app's `Viewer` that stood in the moved file, and `src/state/gta6_worldview/stream_viewer_tests.rs` +- **What the app keeps.** `src/state/gta6/world/gta6_world/worldview/grass.rs` is the one method of the + app's `Viewer` that stood in the moved file, and `src/state/gta6/world/gta6_world/worldview/stream_viewer.rs` the two tests that build a `Viewer` to see a dead thread started again. The other tests of the moved files run under their names in the adapter. The feature `made-up` also builds what the app's tests drive a `Streamer` and a `World` by. @@ -2896,7 +2896,7 @@ and `presets` the three sets. switched off, which leaves the picture at once and not with the next answer (`a_layer_switched_off_leaves_the_picture_at_once_and_the_rest_is_not_asked_again`); `src/ui/panels/world_viewer/layers.rs` is the section, the painting over the frame, the legend - and the pick in pixels (`src/state/the_world_screen_shows_layers.rs`). + and the pick in pixels (`src/state/tests/the_world_screen_shows_layers.rs`). - **The verb.** `openrage-cli world layers --at [--radius ] [--layers ,...] [--json]` answers through the registry for any title that states layers (`the_layers_a_world_states_are_said_within_a_radius_as_lines_and_as_json`), and reads the place @@ -2916,12 +2916,12 @@ and opens the next. | Module | What it holds | |---|---| | `src/state/world_session/mod.rs` | `WorldSession`, what the screen and the panel ask (where it stands, its capabilities, its title's options, its camera and hour, what is waited for, what could not be read with its reason), and `WorldFeed`, what the bridge takes and tells back: the last selection, models and textures as plain data, the look's frame values, where a model stands on the device | -| `src/state/world_session/driven.rs` | `DrivenSession`: a title of `or_worlds` opens the install, the core's `Driver` streams and selects on the session's thread, and maps, models and textures are read in three of the core's `Pool`s; an interior is read on that thread. Nothing is read on the thread that draws | +| `src/state/world_session/driven/mod.rs` | `DrivenSession`: a title of `or_worlds` opens the install, the core's `Driver` streams and selects on the session's thread, and maps, models and textures are read in three of the core's `Pool`s; an interior is read on that thread. Nothing is read on the thread that draws | | `src/state/world_session/mesh.rs` | a core `Model`, the game's vertex bytes with their layout, handed on as they are with the maps each mesh's shader binds (`arrived`), its positions alone decoded on a reader to the `Shape` a pick tests | | `src/state/world_session/gta6.rs` | `Gta6Session`, a shell over GTA VI's viewer that hands the bridge no feed, answers a click on a thread of its own, draws a map as its document's tree places it (`lay_document`) and states `Capability::Pick` and `Capability::Edits` | -| `src/state/gta6_world_edit.rs` | the World screen's edits of a GTA VI build: `edit_gta6_world_selection` stands, turns or scales the entity picked in the document of its map, opened behind the screen, as one step of that document; `world_follows_the_documents` lays each such map over the world by its document's revision; `world_edited_document` is the document the screen's Undo steps | -| `src/state/gta6_world_delete.rs` | an entity taken out from the World screen, a submodule of `gta6_map`: `delete_gta6_world_selection` asks the session which maps the removal renumbers (`WorldSession::renumbered_with`, from the index's parent names), reads those no document holds on a worker (`WorldRemoval`, a job the list shows and stops), and `poll_world_removal` makes `or_world_gta6::edit::entities`' removal a step of each document, kept as one group (`MapsWork::world_groups`) that `world_step_follows` steps together from `AppState::step` | -| `src/state/gta6_world_fits.rs` | whether the map document the World screen last changed still fits its archive: `world_fit_is_asked` plans its save on a worker with `AppState::archive_copy_plan`, the plan File ▸ Save into a copy of the archive… makes, writing nothing; `world_fit` gives the `Fit` of the document's revision and asks again where it changed | +| `src/state/gta6/world/gta6_world_edit.rs` | the World screen's edits of a GTA VI build: `edit_gta6_world_selection` stands, turns or scales the entity picked in the document of its map, opened behind the screen, as one step of that document; `world_follows_the_documents` lays each such map over the world by its document's revision; `world_edited_document` is the document the screen's Undo steps | +| `src/state/gta6/world/gta6_map/world_delete.rs` | an entity taken out from the World screen, a submodule of `gta6_map`: `delete_gta6_world_selection` asks the session which maps the removal renumbers (`WorldSession::renumbered_with`, from the index's parent names), reads those no document holds on a worker (`WorldRemoval`, a job the list shows and stops), and `poll_world_removal` makes `or_world_gta6::edit::entities`' removal a step of each document, kept as one group (`MapsWork::world_groups`) that `world_step_follows` steps together from `AppState::step` | +| `src/state/gta6/world/gta6_world_fits.rs` | whether the map document the World screen last changed still fits its archive: `world_fit_is_asked` plans its save on a worker with `AppState::archive_copy_plan`, the plan File ▸ Save into a copy of the archive… makes, writing nothing; `world_fit` gives the `Fit` of the document's revision and asks again where it changed | | `src/ui/panels/world_viewer/keys.rs` | the keys of a World view, shared by GTA V's and GTA VI's: `holds_keys` (a field that holds the keyboard takes its keys), `fly`, `world_command`, `edit_key` and `run`, which runs Undo, Redo and Delete for a view that holds the keyboard and the view's own command | | `src/render/viewport/world_plain.rs` | the bridge's path for a feed: each mesh in the renderer's store as its file lays it, one material a colour map and bucket, every other map a material binds brought to the device where the budgets say so, instances culled by their spheres and laid a run a model and level, drawn in the plain mode chosen for the world under the viewport's own lights and background | | `src/render/viewport/world_host.rs` | what that path and GTA VI's bridge both call ([the store](#what-the-store-holds-and-what-it-measured)): the budgets, a mesh of the store as the renderer draws it, a material made again, a frame's draws handed over, and the overlay's draws of what is picked (`marks`) | @@ -2965,22 +2965,22 @@ and opens the next. (`selection_drawn` with `Edits`), `world_viewer::change::done` applies what either panel asked, and `world_viewer::gizmo` drives and paints the manipulator over GTA VI's view. What is GTA V's alone is behind `AppState::world_is_of_documents`: `world_edit_refused` asks for no - project, `edit_world_selection` hands the change to `src/state/gta6_world_edit.rs`, and the + project, `edit_world_selection` hands the change to `src/state/gta6/world/gta6_world_edit.rs`, and the tool's target takes GTA VI's address as it is. - - *Placement.* The adapter's pure placement, `crates/domain/or-world-gta6/src/edit.rs` + - *Placement.* The adapter's pure placement, `crates/domain/or-world-gta6/src/edit/mod.rs` (`placing`, `set`, `place`, `over`, with the extents of - `crates/domain/or-world-gta6/src/edit_extents.rs`), which the Map screen's move and retype call + `crates/domain/or-world-gta6/src/edit/extents.rs`), which the Map screen's move and retype call through `place_map_entity` and `set_map_entity`: the document's tree takes the values and the undo is the values it held. - - *Removal.* `crates/domain/or-world-gta6/src/edit_entities.rs` is the edit of a map's entities + - *Removal.* `crates/domain/or-world-gta6/src/edit/entities/mod.rs` is the edit of a map's entities over the sections of its body and of the maps that name it (`gta6_entity_edit`), moved from `or-cli`, which re-exports it for `rpf map-entity` and the Map screen; its hand-built bodies are `entities::made_up`, behind the `made-up` feature. The World screen finds the maps to renumber through the index (`MapRow`'s run of parent names, `WorldIndex::parents_of`): `Gta6Session::renumbered_with` gives the rows that state the entity's map and the row its parent names, as document paths. ⚠ The index states the build as indexed, so - `src/state/gta6_world_delete.rs` also reads the links of each open map document. - - *What the world draws.* `crates/domain/or-world-gta6/src/stream_laid.rs`: `World::lay` holds + `src/state/gta6/world/gta6_map/world_delete.rs` also reads the links of each open map document. + - *What the world draws.* `crates/domain/or-world-gta6/src/stream/laid.rs`: `World::lay` holds a map in `Laid`, which the streamer's readers and `Bodies::read` read before the archive, and `Streamer::relay` reads a loaded map again on the streamer's thread and swaps its nodes in the same turn, so the far model never stands in. `Gta6Session::lay_document` takes a `LaidTree`: @@ -2999,7 +2999,7 @@ and opens the next. (`Layout::shifted`, `plain::shifted_rows`), and lays out again at each step. After the release the session stays `pick_pending` while the selection drawn still holds those rows, so the manipulator ends the shift only once the map was read again. - - *Whether it fits.* `src/state/gta6_world_fits.rs`, above. + - *Whether it fits.* `src/state/gta6/world/gta6_world_fits.rs`, above. ⚠ The body of a map is read and written back on the UI thread at each change. ⚠ An instance a drag moves is culled where it stood. Held by @@ -3024,7 +3024,7 @@ and opens the next. (`CpuModel::shape`, `Viewer::hold_shape`, dropped when the bridge says the model left), and `Viewer::pick_standing` hands a click the last selection, those shapes, which models are ready and the maps' bodies. `Gta6Session::click` starts a thread on that and returns; the thread runs - `stream::pick::pick` of `crates/domain/or-world-gta6/src/stream_pick.rs`, which lays the + `stream::pick::pick` of `crates/domain/or-world-gta6/src/stream/pick/mod.rs`, which lays the selection out as the core's columns (`columns`: an instance of a chunk a swap gates is met on its side of the swap alone, and one that only casts a shadow never), calls the core's `pick`, and names what was met from its map's body read again (`Bodies`): the node's place is @@ -3083,7 +3083,7 @@ and opens the next. taken at the start of a turn, with the bodies laid: taken later it would be answered from a selection made before the edit reached the forest, which the shots of a real install showed. A world opened over an open project draws that project's maps from its first frame (`world_follows_the_project`, over `store::held_bodies`), and what another project laid - is drawn as the install has it again. Held by `src/state/the_world_screen_edits_a_project.rs`. + is drawn as the install has it again. Held by `src/state/tests/the_world_screen_edits_a_project.rs`. ⚠ Every source of the maps content is read on the frame the world opens. - **A map of the store's own, an add and a copy.** `lay` takes a `LaidMap`: a body and, for a map the index has no row of, the `OwnMap` row the store states, which `Laid` answers the driver as @@ -3096,7 +3096,7 @@ and opens the next. `world_add_settles`, run each frame by the view, applies it when the answer came. ⚠ The names the Add field searches are read from the index once a world, every archetype looked up by the model file called by it, on the thread that draws. Held by - `src/state/the_world_screen_adds_and_copies.rs`, each part seen failing: a probe that meets + `src/state/tests/the_world_screen_adds_and_copies.rs`, each part seen failing: a probe that meets nothing drawn, an added node not picked, a copy with no offset, extents not grown by the game's boxes, and a world opened over a project that lays none of its own maps. The probe's ground and point-ahead answers are held on the fake title @@ -3127,9 +3127,9 @@ and opens the next. the session says its selection again: the changed map enters the forest afresh, and the object would be drawn where it stood for the turns between. The view's rectangle is kept in `WorldTool::view` for the shots step that pulls a handle. Held, through real frames of the - view with no window, by `src/state/the_world_screen_has_a_manipulator.rs`. + view with no window, by `src/state/tests/the_world_screen_has_a_manipulator.rs`. - **What is still GTA VI's own.** `Gta6Session` answers the seam from the viewer of - `src/state/gta6_worldview/mod.rs`, which is one static; GTA VI's screen, its panel and + `src/state/gta6/world/gta6_world/worldview/mod.rs`, which is one static; GTA VI's screen, its panel and `refresh_world` of the bridge reach that viewer themselves and name its types. The seam is where they are to meet the driven path, and nothing of GTA VI's frame goes through it yet. - **Reasons.** The core's `ModelReader` gained `models_or_why` and `textures_or_why`, which answer @@ -3378,7 +3378,7 @@ RSC7 version, and saves through `Asset::to_bytes_repairing`; only `.ypt` (its canonical step) and `.ysc` (its decompiled listing) add to that. A `kinds` row is optional; without one the row is visibly provisional (`a_format_nobody_described_gets_an_obviously_provisional_row`). -`src/state/adding_a_format.rs` declares a format inside itself and walks +`src/state/tests/adding_a_format.rs` declares a format inside itself and walks detected → named → opens → described (`a_synthetic_format_is_fully_usable`); it lives in `src/` because the `openrage` package has no library target. The opens rung needs a payload of the requested kind, since counting a parse error as @@ -3416,7 +3416,7 @@ another kind is opened from a path. One kind serves the headerless resources: a bound and a dictionary are all `Gta6Drawable`, whose payload is whichever resource the reader read. A GTA VI metadata body is a `Meta` document, and its mission state tables, its anim scene's timeline and its map on the Map screen are views over that document and no kind of their own. A kind that saves its -edits returns them from `edited_sections`, and `src/state/gta6_resource_save.rs` writes them as a +edits returns them from `edited_sections`, and `src/state/gta6/bodies/gta6_resource_save/mod.rs` writes them as a loose resource. `src/state/capabilities.rs` is the table, builtins plus a process-global behind @@ -3629,7 +3629,7 @@ A menu is as wide as its widest row in every language but English ## The src/ code-line gate What the app crate's own suites hold about its size and shape: -`src/repo_tests/shell_budget.rs`, `src/repo_tests/suppressions.rs` and `src/state/tests.rs`, each a +`src/repo_tests/shell_budget.rs`, `src/repo_tests/suppressions.rs` and `src/state/tests/mod.rs`, each a `#[cfg(test)]` module run by `cargo test --bin openrage`. ### No file in src/ is over 900 code lines diff --git a/plugins/README.md b/plugins/README.md index 199727dd5..663feb233 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -119,7 +119,7 @@ from Tools → Run plugin; a plugin that wants to capability (`plugin.refused`, `cap.edit_open_document`) and the sentence the prompt used. A guest that stops after a refusal is reported with the refusal, and a failed run puts every byte back. -- `src/state/a_plugin_asks_before_it_runs.rs` holds this with the sample guest, +- `src/state/tests/a_plugin_asks_before_it_runs.rs` holds this with the sample guest, both builds. ## Adding to the editor @@ -339,7 +339,7 @@ At run time a format is three registrations and no lines in `src/`: a its resource's own description with a neutral glyph. Its reader returns `DocPayload::Registered { format, data }`, where `data` is an `Arc` the app never looks inside: the generic panels read the document's own decompressed bytes, and `data` goes back -only to your `serialize` and your panels. `src/state/adding_a_format.rs` +only to your `serialize` and your panels. `src/state/tests/adding_a_format.rs` declares such a format inside itself and walks detected, named, opens and described (`a_synthetic_format_is_fully_usable`). What it gets is the generic editor over its bytes, not one written for its semantics. diff --git a/src/repo_tests/doc_citations.rs b/src/repo_tests/doc_citations.rs index 9834b7ba8..92d34725c 100644 --- a/src/repo_tests/doc_citations.rs +++ b/src/repo_tests/doc_citations.rs @@ -69,7 +69,7 @@ const ELSEWHERE: &[(&str, &str)] = &[ ), ( "src/state/gta6_map_extents.rs", - "moved into GTA VI's adapter as crates/domain/or-world-gta6/src/edit_extents.rs; \ + "moved into GTA VI's adapter as crates/domain/or-world-gta6/src/edit/extents.rs; \ the unified world plan lists the old path among the files its row R71i deletes", ), ]; diff --git a/src/repo_tests/doc_counts/figures.rs b/src/repo_tests/doc_counts/figures.rs index 070df346d..26b9695a3 100644 --- a/src/repo_tests/doc_counts/figures.rs +++ b/src/repo_tests/doc_counts/figures.rs @@ -23,11 +23,6 @@ const ASSERTED: &[(&str, &str, &str)] = &[ "units", "a_teleporting_emitter_jumps_the_distance_the_preview_document_states", ), - ( - "docs/direction/Roadmap.md", - "tiles", - "the_thumbnail_cache_holds_the_tiles_the_roadmap_states", - ), ]; /// Counts that name no measurement and no test, each with why that is right. diff --git a/src/state/document/gta6_script_build.rs b/src/state/document/gta6_script/build/mod.rs similarity index 99% rename from src/state/document/gta6_script_build.rs rename to src/state/document/gta6_script/build/mod.rs index c3671a76a..acbd43f57 100644 --- a/src/state/document/gta6_script_build.rs +++ b/src/state/document/gta6_script/build/mod.rs @@ -338,5 +338,4 @@ fn put_file(folder: &Path, name: &str, part_name: &str, bytes: &[u8]) -> Result< } #[cfg(test)] -#[path = "gta6_script_build_tests.rs"] mod tests; diff --git a/src/state/document/gta6_script_build_tests.rs b/src/state/document/gta6_script/build/tests.rs similarity index 100% rename from src/state/document/gta6_script_build_tests.rs rename to src/state/document/gta6_script/build/tests.rs diff --git a/src/state/document/gta6_script_jobs.rs b/src/state/document/gta6_script/jobs.rs similarity index 100% rename from src/state/document/gta6_script_jobs.rs rename to src/state/document/gta6_script/jobs.rs diff --git a/src/state/document/gta6_script_lists.rs b/src/state/document/gta6_script/lists.rs similarity index 100% rename from src/state/document/gta6_script_lists.rs rename to src/state/document/gta6_script/lists.rs diff --git a/src/state/document/gta6_script.rs b/src/state/document/gta6_script/mod.rs similarity index 99% rename from src/state/document/gta6_script.rs rename to src/state/document/gta6_script/mod.rs index 23258df88..369ce410f 100644 --- a/src/state/document/gta6_script.rs +++ b/src/state/document/gta6_script/mod.rs @@ -19,11 +19,8 @@ use or_io::gta6::script::{lift, Context, Level, Options, Stats}; use super::{DocPayload, DocumentId, HexDocument}; use crate::state::AppState; -#[path = "gta6_script_build.rs"] mod build; -#[path = "gta6_script_jobs.rs"] mod jobs; -#[path = "gta6_script_lists.rs"] mod lists; use lists::Stamp; @@ -702,5 +699,4 @@ impl AppState { } #[cfg(test)] -#[path = "gta6_script_tests.rs"] mod tests; diff --git a/src/state/document/gta6_script_tests.rs b/src/state/document/gta6_script/tests.rs similarity index 100% rename from src/state/document/gta6_script_tests.rs rename to src/state/document/gta6_script/tests.rs diff --git a/src/state/document/a_document_that_will_not_save.rs b/src/state/document/meta/a_document_that_will_not_save.rs similarity index 100% rename from src/state/document/a_document_that_will_not_save.rs rename to src/state/document/meta/a_document_that_will_not_save.rs diff --git a/src/state/document/meta.rs b/src/state/document/meta/mod.rs similarity index 99% rename from src/state/document/meta.rs rename to src/state/document/meta/mod.rs index 12a09d71d..17bbb111e 100644 --- a/src/state/document/meta.rs +++ b/src/state/document/meta/mod.rs @@ -55,7 +55,6 @@ pub(super) fn peek_xml_root(bytes: &[u8]) -> Option { } #[cfg(test)] -#[path = "a_document_that_will_not_save.rs"] mod a_document_that_will_not_save; #[derive(Debug, Clone)] diff --git a/src/state/file_io.rs b/src/state/file_io/mod.rs similarity index 99% rename from src/state/file_io.rs rename to src/state/file_io/mod.rs index 27ecc2bc1..bb06d3790 100644 --- a/src/state/file_io.rs +++ b/src/state/file_io/mod.rs @@ -1,7 +1,6 @@ use super::jobs::{file_name, JobKind, Outcome, RunningJob, Then}; use super::*; -#[path = "save_source.rs"] mod save_source; use save_source::write_the_save; pub(super) use save_source::SaveSource; diff --git a/src/state/save_source.rs b/src/state/file_io/save_source.rs similarity index 100% rename from src/state/save_source.rs rename to src/state/file_io/save_source.rs diff --git a/src/state/files_view/mod.rs b/src/state/files_view/mod.rs index b15eb8207..8a7e72e0b 100644 --- a/src/state/files_view/mod.rs +++ b/src/state/files_view/mod.rs @@ -3,7 +3,6 @@ //! exporting a row under a name of the user's. pub mod pictures; -#[path = "../rpf9_tree_row_kind.rs"] mod rpf9_tree_row_kind; use std::collections::HashMap; diff --git a/src/state/rpf9_tree_row_kind.rs b/src/state/files_view/rpf9_tree_row_kind.rs similarity index 100% rename from src/state/rpf9_tree_row_kind.rs rename to src/state/files_view/rpf9_tree_row_kind.rs diff --git a/src/state/gta6_anim_edit.rs b/src/state/gta6/anim/gta6_anim_edit/mod.rs similarity index 93% rename from src/state/gta6_anim_edit.rs rename to src/state/gta6/anim/gta6_anim_edit/mod.rs index 584951fcc..bc3f21ee3 100644 --- a/src/state/gta6_anim_edit.rs +++ b/src/state/gta6/anim/gta6_anim_edit/mod.rs @@ -9,10 +9,12 @@ use std::sync::Arc; use or_io::container::rpf::Rpf9Sections; use or_io::gta6::anim::{AnimEdit, AnimError, AnimResource, ClipEntry, ClipPlay, RootKind}; -use super::{AppState, Change, ClipFieldSnapshot, DocPayload, DocumentId}; +use crate::state::{AppState, Change, ClipFieldSnapshot, DocPayload, DocumentId}; /// The GTA VI animation row's `edited_sections`: the resource's sections once an edit is made. -pub(super) fn edited_sections(payload: &DocPayload) -> Option> { +pub(in crate::state) fn edited_sections( + payload: &DocPayload, +) -> Option> { let DocPayload::Gta6Anim(resource) = payload else { return None; }; @@ -41,12 +43,12 @@ impl AppState { /// Document `doc`'s GTA VI animation resource replaced by what `make` makes of it; the /// resource as it stood before. - pub(super) fn replace_gta6_anim( + pub(in crate::state) fn replace_gta6_anim( &mut self, doc: DocumentId, make: impl FnOnce(&AnimResource) -> Result, ) -> Result, String> { - let gone = || crate::i18n::tr(super::edit_history::GONE).to_string(); + let gone = || crate::i18n::tr(crate::state::edit_history::GONE).to_string(); let held = resource(&mut self.document_mut(doc).ok_or_else(gone)?.payload).ok_or_else(gone)?; let edited = make(held).map_err(|e| e.to_string())?; @@ -83,7 +85,7 @@ impl AppState { let top = |state: &Self| { let history = state.document(doc).map(|d| &d.history); history - .and_then(|h| h.next(super::EditDirection::Undo)) + .and_then(|h| h.next(crate::state::EditDirection::Undo)) .map(|s| s.id) }; let was = top(self); @@ -129,7 +131,7 @@ impl AppState { let top = |state: &Self| { let history = state.document(doc).map(|d| &d.history); history - .and_then(|h| h.next(super::EditDirection::Undo)) + .and_then(|h| h.next(crate::state::EditDirection::Undo)) .map(|s| s.id) }; let was = top(self); @@ -188,7 +190,7 @@ impl AppState { _ => None, }); let searched = (resource.external_sets.iter()) - .filter_map(|k| super::gta6_set_finding::found_set(archive, *k)); + .filter_map(|k| crate::state::gta6_set_finding::found_set(archive, *k)); open.chain(searched).find_map(|set| { (set.sets.iter().flat_map(|s| &s.animations)) .find(|a| a.key == key)? @@ -239,7 +241,7 @@ impl AppState { /// Says, as an edited GTA VI animation resource is saved, which of its words are kept as read. pub(crate) fn say_the_animation_hashes_are_kept(&mut self, doc: DocumentId) { let edited = - |d: &super::Document| matches!(&d.payload, DocPayload::Gta6Anim(r) if r.edited); + |d: &crate::state::Document| matches!(&d.payload, DocPayload::Gta6Anim(r) if r.edited); if self.document(doc).is_some_and(edited) { self.show_warning_toast(tr!("Each edited block keeps the hash at its start as it was read: no rule for it is known, so the game may refuse the saved file. An edited track list is signed again.")); } @@ -247,7 +249,7 @@ impl AppState { /// GTA VI's clip fields: clip `clip`, by its place in the dictionary, when it plays one /// animation. It states no loop flag anyone found. - pub(super) fn gta6_clip_field_snapshot( + pub(in crate::state) fn gta6_clip_field_snapshot( &self, doc: DocumentId, clip: u32, @@ -273,7 +275,7 @@ impl AppState { /// Writes `fields`' window and rate to GTA VI clip `clip`; its name, which its key hashes, /// is renamed apart, and no loop flag is written. - pub(super) fn apply_gta6_clip_fields( + pub(in crate::state) fn apply_gta6_clip_fields( &mut self, doc: DocumentId, clip: u32, @@ -296,5 +298,4 @@ impl AppState { } #[cfg(test)] -#[path = "gta6_anim_edit_tests.rs"] -pub(super) mod tests; +pub(crate) mod tests; diff --git a/src/state/gta6_anim_edit_tests.rs b/src/state/gta6/anim/gta6_anim_edit/tests.rs similarity index 100% rename from src/state/gta6_anim_edit_tests.rs rename to src/state/gta6/anim/gta6_anim_edit/tests.rs diff --git a/src/state/gta6_anim_in_audio_save.rs b/src/state/gta6/anim/gta6_anim_in_audio_save.rs similarity index 92% rename from src/state/gta6_anim_in_audio_save.rs rename to src/state/gta6/anim/gta6_anim_in_audio_save.rs index 5ce880f64..fcda79a0a 100644 --- a/src/state/gta6_anim_in_audio_save.rs +++ b/src/state/gta6/anim/gta6_anim_in_audio_save.rs @@ -2,11 +2,14 @@ //! animation chunk, a step of the container's history, as Save of an archive entry writes it back //! into its archive; saving the container writes it to disk. -use super::{AppState, DocPayload, DocumentId, DocumentKind}; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind}; impl AppState { /// Save of an animation an audio stream stores, into its open container; `None` for any other. - pub(super) fn save_animation_into_its_audio(&mut self, doc: DocumentId) -> Option { + pub(in crate::state) fn save_animation_into_its_audio( + &mut self, + doc: DocumentId, + ) -> Option { let document = self.document(doc)?; if document.kind() != DocumentKind::Gta6Anim { return None; @@ -62,9 +65,9 @@ mod tests { use or_io::awc::AwcChunkKind; use or_io::container::rpf::write_rpf9_resource; - use super::super::an_awc_stream_opens_its_animation::{adat, stored_set}; - use super::super::opening_an_rpf9_archive::{said, settle}; - use super::super::{AppState, DocPayload, DocumentId, ToastType}; + use crate::state::an_awc_stream_opens_its_animation::{adat, stored_set}; + use crate::state::opening_an_rpf9_archive::{said, settle}; + use crate::state::{AppState, DocPayload, DocumentId, ToastType}; fn chunk(state: &mut AppState, doc: DocumentId) -> Vec { let file = state.awc_file(doc).expect("its container"); diff --git a/src/state/gta6_anim_keys.rs b/src/state/gta6/anim/gta6_anim_keys.rs similarity index 99% rename from src/state/gta6_anim_keys.rs rename to src/state/gta6/anim/gta6_anim_keys.rs index 3d101bf34..9259a0f26 100644 --- a/src/state/gta6_anim_keys.rs +++ b/src/state/gta6/anim/gta6_anim_keys.rs @@ -11,7 +11,7 @@ use or_anim::BoneTransform; use or_io::codec::anim::AnimationSource; use or_io::gta6::anim::{AnimAt, AnimEdit, AnimResource, Animation}; -use super::{AppState, Change, DocPayload, DocumentId}; +use crate::state::{AppState, Change, DocPayload, DocumentId}; /// What a key click makes of a track at the playhead's frame. #[derive(Debug, Clone, Copy, PartialEq, Eq)] @@ -340,8 +340,8 @@ impl AppState { #[cfg(test)] mod tests { - use super::super::gta6_anim_edit::tests::dictionary; use super::*; + use crate::state::gta6_anim_edit::tests::dictionary; fn walk() -> Animation { let read = or_io::gta6::anim::read(&dictionary()).expect("the dictionary reads"); diff --git a/src/state/gta6_anim_play.rs b/src/state/gta6/anim/gta6_anim_play.rs similarity index 97% rename from src/state/gta6_anim_play.rs rename to src/state/gta6/anim/gta6_anim_play.rs index afd612231..df46c7ac4 100644 --- a/src/state/gta6_anim_play.rs +++ b/src/state/gta6/anim/gta6_anim_play.rs @@ -11,11 +11,11 @@ use or_io::gta6::anim::{AnimAt, AnimResource, ClipPlay, RootKind}; use or_io::gta6::headerless::Skeleton; use or_transport::Transport; -use super::panel_state::PanelState; -use super::{AppState, DocPayload, Document, DocumentId, DocumentKind, Workspace}; +use crate::state::panel_state::PanelState; +use crate::state::{AppState, DocPayload, Document, DocumentId, DocumentKind, Workspace}; /// A drawable drawn: its document, its contents' epoch, its selection and level of detail. -pub(crate) type DrawnAt = (DocumentId, u64, Option, usize); +pub(crate) type DrawnAt = (DocumentId, u64, Option, usize); pub(crate) struct Model { pub(crate) doc: DocumentId, @@ -271,7 +271,7 @@ pub(crate) fn take(state: &mut AppState, doc_id: DocumentId, resource: &AnimReso } let selected = state.selection.selected(doc_id); if let Some(index) = selected - .and_then(super::SelectionKey::row) + .and_then(crate::state::SelectionKey::row) .and_then(|s| usize::try_from(s).ok()) { if index < choice_count(resource) && index != play.choice { diff --git a/src/state/gta6_bone_edit.rs b/src/state/gta6/anim/gta6_bone_edit/mod.rs similarity index 89% rename from src/state/gta6_bone_edit.rs rename to src/state/gta6/anim/gta6_bone_edit/mod.rs index f68117a0d..5125ac7ce 100644 --- a/src/state/gta6_bone_edit.rs +++ b/src/state/gta6/anim/gta6_bone_edit/mod.rs @@ -11,11 +11,11 @@ use or_io::gta6::headerless::{ bone_name_holds, rebind_under, rename_bones, write_skeleton, Resource, Skeleton, SkeletonOwner, }; -use super::bone_numbers::BoneEdit; -use super::document::Document; -use super::gta6_edit::EditSections; -use super::gta6_resource_save::EditedSave; -use super::{AppState, Change, DocPayload, DocumentId, Swap}; +use crate::state::bone_numbers::BoneEdit; +use crate::state::document::Document; +use crate::state::gta6_edit::EditSections; +use crate::state::gta6_resource_save::EditedSave; +use crate::state::{AppState, Change, DocPayload, DocumentId, Swap}; /// Which skeleton of a scanned body a step edits: its own, or a dictionary entry's by its code. #[derive(Clone, Copy)] @@ -27,9 +27,9 @@ enum Whose { /// `skeleton` swapped with the one held for the scanned body at `path`; `false` where none is. fn swap_held(path: &Path, whose: Whose, skeleton: &mut Skeleton) -> bool { if let Whose::Entry(code) = whose { - return super::gta6_entry_skeletons::swap(path, code, skeleton); + return crate::state::gta6_entry_skeletons::swap(path, code, skeleton); } - match super::rpf9_scan::skeletons().get_mut(path) { + match crate::state::rpf9_scan::skeletons().get_mut(path) { Some(Ok(held)) => { std::mem::swap(held, skeleton); true @@ -143,8 +143,8 @@ impl AppState { let path = (document.path.clone()) .ok_or_else(|| tr!("This document has no file, so it holds no GTA VI skeleton."))?; let mut after = match whose { - Whose::Own => super::rpf9_scan::scanned_skeleton(&path)?, - Whose::Entry(code) => super::gta6_entry_skeletons::of(&path, code).ok_or_else(|| { + Whose::Own => crate::state::rpf9_scan::scanned_skeleton(&path)?, + Whose::Entry(code) => crate::state::gta6_entry_skeletons::of(&path, code).ok_or_else(|| { tr!("This dictionary entry held no skeleton that read when it opened, so it has no bones to edit.") .to_string() })?, @@ -179,8 +179,8 @@ impl AppState { /// The GTA VI drawable row's `edited_sections`: the materials' and physics' edits, then the bones /// the document shows, written over the body read again; `None` where it holds no edit. -pub(super) fn edited_save(document: &Document) -> Option> { - let save = super::gta6_physics_edit::edited_save(document)?; +pub(in crate::state) fn edited_save(document: &Document) -> Option> { + let save = crate::state::gta6_physics_edit::edited_save(document)?; let DocPayload::Gta6Drawable(resource) = &document.payload else { return Some(save); }; @@ -190,11 +190,13 @@ pub(super) fn edited_save(document: &Document) -> Option, Skeleton)> = match **resource { Resource::Drawable(_) | Resource::DrawableWithBound(_) => { - (super::rpf9_scan::scanned_skeleton(path).ok().into_iter()) - .map(|skeleton| (None, skeleton)) - .collect() + (crate::state::rpf9_scan::scanned_skeleton(path) + .ok() + .into_iter()) + .map(|skeleton| (None, skeleton)) + .collect() } - Resource::Dictionary(_) => (super::gta6_entry_skeletons::all(path).into_iter()) + Resource::Dictionary(_) => (crate::state::gta6_entry_skeletons::all(path).into_iter()) .map(|(code, skeleton)| (Some(code), skeleton)) .collect(), _ => Vec::new(), @@ -236,5 +238,4 @@ pub(super) fn edited_save(document: &Document) -> Option Option { } /// A search; a new one replaces the one running, and dropping it stops it. -pub(super) struct ClipFinding { +pub(in crate::state) struct ClipFinding { cancel: Cancel, progress: Progress, ended: Arc>>, @@ -151,7 +151,7 @@ fn dictionary_at(file: &File, offset: u64) -> Option { impl AppState { /// The job list's row for the search, while it runs. - pub(super) fn clip_finding_job(&self) -> Option { + pub(in crate::state) fn clip_finding_job(&self) -> Option { let finding = self.clip_finding.as_ref()?; if finding.ended().is_some() { return None; @@ -166,7 +166,7 @@ impl AppState { } /// Ask the search to stop; it says it stopped once its worker sees the stop. - pub(super) fn stop_clip_finding(&self) { + pub(in crate::state) fn stop_clip_finding(&self) { if let Some(finding) = &self.clip_finding { finding.cancel.set(); } @@ -230,7 +230,7 @@ impl AppState { } /// Say in the job list how the search ended, once it has, and drop it. - pub(super) fn poll_clip_finding(&mut self) { + pub(in crate::state) fn poll_clip_finding(&mut self) { let Some(ended) = self.clip_finding.as_ref().and_then(ClipFinding::ended) else { return; }; diff --git a/src/state/gta6_entry_skeletons.rs b/src/state/gta6/anim/gta6_entry_skeletons.rs similarity index 92% rename from src/state/gta6_entry_skeletons.rs rename to src/state/gta6/anim/gta6_entry_skeletons.rs index a0e5f8d87..a3f88a028 100644 --- a/src/state/gta6_entry_skeletons.rs +++ b/src/state/gta6/anim/gta6_entry_skeletons.rs @@ -6,8 +6,8 @@ use std::sync::{Mutex, MutexGuard}; use or_io::gta6::headerless::{read_dictionary_skeletons, Resource, Skeleton}; -use super::selection::{DictPart, SelectionKey}; -use super::{DocPayload, Document}; +use crate::state::selection::{DictPart, SelectionKey}; +use crate::state::{DocPayload, Document}; type Held = BTreeMap>; @@ -22,7 +22,7 @@ fn entries() -> MutexGuard<'static, Held> { /// Keep the skeletons of the drawable entries of the dictionary at the root of `virtual_section`, /// opened at `path`; one whose skeletons do not read keeps none, and its entries export with no bones. -pub(super) fn keep(path: &Path, virtual_section: &[u8]) { +pub(in crate::state) fn keep(path: &Path, virtual_section: &[u8]) { let skeletons = read_dictionary_skeletons(virtual_section).unwrap_or_default(); entries().insert(path.to_path_buf(), skeletons); } @@ -41,12 +41,12 @@ pub(crate) fn hold(path: &Path, skeletons: Vec<(u32, Skeleton)>) { } /// Every entry skeleton held for the dictionary opened at `path`, by code. -pub(super) fn all(path: &Path) -> Vec<(u32, Skeleton)> { +pub(in crate::state) fn all(path: &Path) -> Vec<(u32, Skeleton)> { entries().get(path).cloned().unwrap_or_default() } /// `skeleton` swapped with entry `code`'s of the dictionary at `path`; `false` where none is held. -pub(super) fn swap(path: &Path, code: u32, skeleton: &mut Skeleton) -> bool { +pub(in crate::state) fn swap(path: &Path, code: u32, skeleton: &mut Skeleton) -> bool { let mut held = entries(); let found = (held.get_mut(path).into_iter().flatten()).find(|(c, _)| *c == code); match found { @@ -86,7 +86,7 @@ pub(crate) fn shown(doc: &Document, selection: Option) -> Option of(path, code), - None => super::rpf9_scan::scanned_skeleton(path) + None => crate::state::rpf9_scan::scanned_skeleton(path) .ok() .or_else(|| all(path).into_iter().next().map(|(_, s)| s)), } diff --git a/src/state/gta6_expression_edit.rs b/src/state/gta6/anim/gta6_expression_edit.rs similarity index 96% rename from src/state/gta6_expression_edit.rs rename to src/state/gta6/anim/gta6_expression_edit.rs index a9b0d93eb..ef06d7dee 100644 --- a/src/state/gta6_expression_edit.rs +++ b/src/state/gta6/anim/gta6_expression_edit.rs @@ -11,10 +11,10 @@ use or_io::gta6::anim::{ }; use or_io::gta6::hash::name_hash32; -use super::document::Document; -use super::gta6_edit::EditSections; -use super::gta6_resource_save::EditedSave; -use super::{AppState, Change, DocPayload, DocumentId}; +use crate::state::document::Document; +use crate::state::gta6_edit::EditSections; +use crate::state::gta6_resource_save::EditedSave; +use crate::state::{AppState, Change, DocPayload, DocumentId}; /// The expression set row's `edited_sections` once an id is edited: its body read again on the /// worker and the ids written over it. @@ -25,7 +25,7 @@ pub(crate) fn edited_save(document: &Document) -> Option = Arc::new(move |_, sections: &mut Rpf9Sections| { let physical = sections.physical.len(); diff --git a/src/state/gta6_face.rs b/src/state/gta6/anim/gta6_face/mod.rs similarity index 96% rename from src/state/gta6_face.rs rename to src/state/gta6/anim/gta6_face/mod.rs index 7f777948a..48b2c2a50 100644 --- a/src/state/gta6_face.rs +++ b/src/state/gta6/anim/gta6_face/mod.rs @@ -14,7 +14,7 @@ use or_io::gta6::headerless::{ read_dictionary_skeletons, Drawable, Entry, Palette, Resource, Skeleton, }; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::{AppState, DocPayload, DocumentId}; /// The first bone of every face skeleton. const FACIAL_ROOT: u32 = name_hash32(b"FACIAL_C_FacialRoot"); @@ -32,7 +32,7 @@ fn lock(map: &'static Mutex) -> MutexGuard<'static, T> { } /// What a headerless body opened from a scan adds to what the Animation workspace plays with. -pub(super) enum Learned { +pub(in crate::state) enum Learned { /// A dictionary's lone face skeleton, which picking the dictionary as a model poses. Skeleton(Skeleton), /// An expression set, which opens as a document of its own. @@ -42,7 +42,7 @@ pub(super) enum Learned { } /// Keep the face skeletons or the expression set of the body of `signature` opened at `path`. -pub(super) fn learn( +pub(in crate::state) fn learn( path: &Path, signature: Rpf9Signature, virtual_section: &[u8], @@ -91,7 +91,7 @@ pub(crate) fn is_face(skeleton: &Skeleton) -> bool { pub(crate) fn facts(set: &Expressions) -> String { let mut lines = vec![tr!( "A GTA VI expression set of key {key}.", - key = super::gta6_names::said32(set.key) + key = crate::state::gta6_names::said32(set.key) )]; lines.push(tr_n!( "It reads {count} track: the facial controls, or bones, a clip carries.", @@ -150,7 +150,7 @@ fn tables(set: &Expressions) -> Vec { lines.push(format!("{} ({})", group_label(group), tracks.tracks.len())); for (k, (id, word)) in tracks.tracks.iter().enumerate() { let detail = track_detail(set, group, k); - let id = super::gta6_names::said32(*id); + let id = crate::state::gta6_names::said32(*id); lines.push(format!(" {id} {}: {detail}", track_label(*word))); } } @@ -289,7 +289,7 @@ pub(crate) fn model_skeleton( doc: DocumentId, path: &Path, ) -> Result { - let own = super::rpf9_scan::scanned_skeleton(path); + let own = crate::state::rpf9_scan::scanned_skeleton(path); let drawable = match state.document(doc).map(|d| &d.payload) { Some(DocPayload::Gta6Drawable(resource)) => match &**resource { Resource::Drawable(d) => d, @@ -298,7 +298,7 @@ pub(crate) fn model_skeleton( Resource::Dictionary(_) => { let selected = state.selection.selected(doc); let entry = (state.document(doc)) - .and_then(|d| super::gta6_entry_skeletons::shown(d, selected)); + .and_then(|d| crate::state::gta6_entry_skeletons::shown(d, selected)); return entry.ok_or_else(|| { tr!("Select a drawable of this dictionary that holds a skeleton, then pick the model again.") .to_string() @@ -321,7 +321,7 @@ pub(crate) fn model_skeleton( return why; } let bones: Vec = (bones.iter()) - .map(|h| super::gta6_names::said32(*h)) + .map(|h| crate::state::gta6_names::said32(*h)) .collect(); tr!( "No open dictionary holds {entries}, the face skeleton this head's name names, and the head has no skeleton of its own, so no skeleton holds the bones its palette names: {bones}. Open that dictionary from a scan of its archive, then pick the head again.", @@ -332,5 +332,4 @@ pub(crate) fn model_skeleton( } #[cfg(test)] -#[path = "gta6_face_tests.rs"] mod tests; diff --git a/src/state/gta6_face_tests.rs b/src/state/gta6/anim/gta6_face/tests.rs similarity index 100% rename from src/state/gta6_face_tests.rs rename to src/state/gta6/anim/gta6_face/tests.rs diff --git a/src/state/gta6_filter_edit.rs b/src/state/gta6/anim/gta6_filter_edit.rs similarity index 96% rename from src/state/gta6_filter_edit.rs rename to src/state/gta6/anim/gta6_filter_edit.rs index 57e786307..89ff15c64 100644 --- a/src/state/gta6_filter_edit.rs +++ b/src/state/gta6/anim/gta6_filter_edit.rs @@ -11,8 +11,8 @@ use or_io::gta6::headerless::{ Dictionary, Entry, FilterTrack, HeaderlessError, Resource, }; -use super::edit_history::Change; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::edit_history::Change; +use crate::state::{AppState, DocPayload, DocumentId}; /// What an edit of a dictionary's frame filter or animation record sets. #[derive(Debug, Clone, Copy, PartialEq)] @@ -59,13 +59,13 @@ fn alone(mut change: Change) -> Change { /// What a save writes of one entry: a frame filter's tracks or an animation record's bones. #[derive(Debug, Clone, PartialEq)] -pub(super) enum Values { +pub(in crate::state) enum Values { Filter(Vec), Record(Vec), } /// `payload`'s dictionary, while no other holder of the body reads it. -pub(super) fn dictionary_mut(payload: &mut DocPayload) -> Option<&mut Dictionary> { +pub(in crate::state) fn dictionary_mut(payload: &mut DocPayload) -> Option<&mut Dictionary> { let DocPayload::Gta6Drawable(resource) = payload else { return None; }; @@ -212,7 +212,7 @@ impl AppState { /// Each frame filter's and animation record's values in `resource`, by code, as a save writes /// them; none for a resource that is no dictionary. -pub(super) fn values_of(resource: &Resource) -> Vec<(u32, Values)> { +pub(in crate::state) fn values_of(resource: &Resource) -> Vec<(u32, Values)> { let Resource::Dictionary(dict) = resource else { return Vec::new(); }; @@ -229,7 +229,10 @@ pub(super) fn values_of(resource: &Resource) -> Vec<(u32, Values)> { /// `values` written over `sections`: in place where an entry holds the tracks or bones it was read /// with, else laid out again through the section's growth. -pub(super) fn write(sections: &mut Rpf9Sections, values: &[(u32, Values)]) -> Result<(), String> { +pub(in crate::state) fn write( + sections: &mut Rpf9Sections, + values: &[(u32, Values)], +) -> Result<(), String> { for (code, held) in values { let v = &mut sections.virtual_section; let in_place = match held { diff --git a/src/state/gta6_filter_entries.rs b/src/state/gta6/anim/gta6_filter_entries.rs similarity index 96% rename from src/state/gta6_filter_entries.rs rename to src/state/gta6/anim/gta6_filter_entries.rs index d0a887979..4b521b35e 100644 --- a/src/state/gta6_filter_entries.rs +++ b/src/state/gta6/anim/gta6_filter_entries.rs @@ -13,13 +13,13 @@ use or_io::gta6::headerless::{ HeaderlessError, Resource, }; -use super::edit_history::{Change, Swap}; -use super::gta6_filter_edit::{dictionary_mut, Values}; -use super::{AppState, DocumentId}; +use crate::state::edit_history::{Change, Swap}; +use crate::state::gta6_filter_edit::{dictionary_mut, Values}; +use crate::state::{AppState, DocumentId}; /// Each entry of a dictionary by code, with a frame filter's or animation record's name and /// whether it is a filter. -pub(super) type Entries = Vec<(u32, Option<(String, bool)>)>; +pub(in crate::state) type Entries = Vec<(u32, Option<(String, bool)>)>; /// The entry of `code` at `at` of a dictionary payload, or held by the step while it is not there. struct EntrySlot { @@ -29,7 +29,7 @@ struct EntrySlot { } impl Swap for EntrySlot { - fn swap(&mut self, payload: &mut super::DocPayload) -> bool { + fn swap(&mut self, payload: &mut crate::state::DocPayload) -> bool { let Some(dict) = dictionary_mut(payload) else { return false; }; @@ -137,7 +137,7 @@ impl AppState { /// Every entry of `resource` by code, as [`Entries`] states them; none for a resource that is no /// dictionary. -pub(super) fn entries_of(resource: &Resource) -> Entries { +pub(in crate::state) fn entries_of(resource: &Resource) -> Entries { let Resource::Dictionary(dict) = resource else { return Vec::new(); }; @@ -157,7 +157,7 @@ pub(super) fn entries_of(resource: &Resource) -> Entries { /// not added to it, each a copy of a stored entry of its kind, the one holding what `values` gives /// it where there is one; then each stored one `entries` lacks removed. // Copies go first, so an entry copied and then removed is still there to copy from. -pub(super) fn add_and_remove( +pub(in crate::state) fn add_and_remove( sections: &mut Rpf9Sections, entries: &[(u32, Option<(String, bool)>)], values: &[(u32, Values)], diff --git a/src/state/gta6_set_finding.rs b/src/state/gta6/anim/gta6_set_finding/mod.rs similarity index 95% rename from src/state/gta6_set_finding.rs rename to src/state/gta6/anim/gta6_set_finding/mod.rs index 22d502bc7..32bac766c 100644 --- a/src/state/gta6_set_finding.rs +++ b/src/state/gta6/anim/gta6_set_finding/mod.rs @@ -11,9 +11,9 @@ use or_io::container::rpf::{read_rpf9_body, Rpf9BodyKind, Rpf9ZlibRun}; use or_io::gta6::anim::{AnimResource, RootKind}; use or_job::{Cancel, Progress}; -use super::jobs::{JobKind, Outcome, RunningJob, Then}; -use super::rpf9_scan::{scanned_body, view_of, Row, View}; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::jobs::{JobKind, Outcome, RunningJob, Then}; +use crate::state::rpf9_scan::{scanned_body, view_of, Row, View}; +use crate::state::{AppState, DocPayload, DocumentId}; /// The bytes a body is read to: more than any lone set was measured to hold. const BODY_LIMIT: u64 = 256 << 20; @@ -33,14 +33,14 @@ pub(crate) fn found_set(archive: &Path, key: u32) -> Option> { /// How a search ended. #[derive(Debug, Clone, PartialEq, Eq)] -pub(super) enum FindEnded { +pub(in crate::state) enum FindEnded { /// How many sets it found, and how many it looked for. Found(usize, usize), Stopped, Failed(String), } -pub(super) struct SetFinding { +pub(in crate::state) struct SetFinding { cancel: Cancel, progress: Progress, ended: Arc>>, @@ -188,21 +188,21 @@ impl AppState { } /// The searches still running, as the job list draws them. - pub(super) fn set_finding_jobs(&self) -> impl Iterator + '_ { + pub(in crate::state) fn set_finding_jobs(&self) -> impl Iterator + '_ { (self.set_finding.iter().filter_map(SetFinding::job)) .chain(self.clip_finding_job()) .chain(self.particle_model_finding_job()) } /// Ask every search to stop; each says it stopped once its worker sees the stop. - pub(super) fn stop_set_finding(&self) { + pub(in crate::state) fn stop_set_finding(&self) { self.set_finding.iter().for_each(|f| f.cancel.set()); self.stop_clip_finding(); self.stop_particle_model_finding(); } /// Say in the job list how each search that ended went, and drop it. - pub(super) fn poll_set_finding(&mut self) { + pub(in crate::state) fn poll_set_finding(&mut self) { self.poll_clip_finding(); self.poll_particle_model_finding(); let mut ended = Vec::new(); @@ -239,5 +239,4 @@ impl AppState { } #[cfg(test)] -#[path = "gta6_set_finding_tests.rs"] mod tests; diff --git a/src/state/gta6_set_finding_tests.rs b/src/state/gta6/anim/gta6_set_finding/tests.rs similarity index 98% rename from src/state/gta6_set_finding_tests.rs rename to src/state/gta6/anim/gta6_set_finding/tests.rs index 528da672a..9154868fa 100644 --- a/src/state/gta6_set_finding_tests.rs +++ b/src/state/gta6/anim/gta6_set_finding/tests.rs @@ -1,7 +1,7 @@ use std::time::{Duration, Instant}; -use super::super::opening_an_rpf9_archive::{rpf9_head, scanned, written, zlib}; use super::*; +use crate::state::opening_an_rpf9_archive::{rpf9_head, scanned, written, zlib}; use crate::state::rpf9_scan::body_path; /// A lone animation set named `name`, of at most 15 bytes, with no animation, as a virtual section. diff --git a/src/state/gta6/anim/mod.rs b/src/state/gta6/anim/mod.rs new file mode 100644 index 000000000..4e4784559 --- /dev/null +++ b/src/state/gta6/anim/mod.rs @@ -0,0 +1,12 @@ +pub(crate) mod gta6_anim_edit; +pub(crate) mod gta6_anim_in_audio_save; +pub(crate) mod gta6_anim_keys; +pub(crate) mod gta6_anim_play; +pub(crate) mod gta6_bone_edit; +pub(crate) mod gta6_clip_finding; +pub(crate) mod gta6_entry_skeletons; +pub(crate) mod gta6_expression_edit; +pub(crate) mod gta6_face; +pub(crate) mod gta6_filter_edit; +pub(crate) mod gta6_filter_entries; +pub(crate) mod gta6_set_finding; diff --git a/src/state/gta6_audio_links.rs b/src/state/gta6/audio/gta6_audio_links/mod.rs similarity index 97% rename from src/state/gta6_audio_links.rs rename to src/state/gta6/audio/gta6_audio_links/mod.rs index 4ca75edbb..7754029ab 100644 --- a/src/state/gta6_audio_links.rs +++ b/src/state/gta6/audio/gta6_audio_links/mod.rs @@ -13,9 +13,9 @@ use or_io::gta6::audio_data::{AudioData, AudioDataKind}; use or_io::gta6::audio_links::{config_names, BankLink, WaveIndex}; use or_job::{Cancel, Progress}; -use super::jobs::{JobKind, RunningJob}; -use super::rpf9_scan::{row_at_offset, scanned_body, Row, Rpf9ScanDocument}; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::jobs::{JobKind, RunningJob}; +use crate::state::rpf9_scan::{row_at_offset, scanned_body, Row, Rpf9ScanDocument}; +use crate::state::{AppState, DocPayload, DocumentId}; /// The most streams a container's table is read for: more than any container was measured to hold. const MAX_STREAMS: u32 = 1 << 20; @@ -189,7 +189,7 @@ fn waves( /// The stream table's words of the container at `offset`, which the scan listed with `flags` and /// `streams`. -pub(super) fn stream_words( +pub(in crate::state) fn stream_words( mut file: &File, offset: u64, flags: u16, @@ -340,7 +340,7 @@ impl AppState { } /// The looks still running, as the job list draws them. - pub(super) fn audio_linking_jobs(&self) -> impl Iterator + '_ { + pub(in crate::state) fn audio_linking_jobs(&self) -> impl Iterator + '_ { (self.documents.iter()).filter_map(|d| match &d.payload { DocPayload::Gta6AudioData(audio) => audio.linking.as_ref()?.job(), _ => None, @@ -348,7 +348,7 @@ impl AppState { } /// Ask every look to stop. - pub(super) fn stop_audio_linking(&self) { + pub(in crate::state) fn stop_audio_linking(&self) { for d in &self.documents { if let DocPayload::Gta6AudioData(audio) = &d.payload { if let Some(linking) = &audio.linking { @@ -384,5 +384,4 @@ fn pool_candidates(rows: &[Row], offset: u64) -> Option> { } #[cfg(test)] -#[path = "gta6_audio_links_tests.rs"] mod tests; diff --git a/src/state/gta6_audio_links_tests.rs b/src/state/gta6/audio/gta6_audio_links/tests.rs similarity index 98% rename from src/state/gta6_audio_links_tests.rs rename to src/state/gta6/audio/gta6_audio_links/tests.rs index 36091ea02..53c476318 100644 --- a/src/state/gta6_audio_links_tests.rs +++ b/src/state/gta6/audio/gta6_audio_links/tests.rs @@ -1,10 +1,10 @@ use std::time::{Duration, Instant}; -use super::super::opening_a_gta_vi_awc::{gta_vi, opus_packets, opus_single}; -use super::super::opening_an_rpf9_archive::{rows, rpf9_head, scanned, settle, written, zlib}; use super::*; use crate::state::gta6_text::Gta6AudioDocument; use crate::state::jobs::JobKind; +use crate::state::opening_a_gta_vi_awc::{gta_vi, opus_packets, opus_single}; +use crate::state::opening_an_rpf9_archive::{rows, rpf9_head, scanned, settle, written, zlib}; use crate::state::rpf9_scan::{body_path, View}; use crate::state::DocumentKind; use or_io::gta6::audio_data::STAMP; diff --git a/src/state/gta6_dialogue.rs b/src/state/gta6/audio/gta6_dialogue/mod.rs similarity index 97% rename from src/state/gta6_dialogue.rs rename to src/state/gta6/audio/gta6_dialogue/mod.rs index 1b314ed1e..29e030def 100644 --- a/src/state/gta6_dialogue.rs +++ b/src/state/gta6/audio/gta6_dialogue/mod.rs @@ -17,9 +17,9 @@ use or_io::gta6::text::TextTable; use or_io::gta6::text_language::{registered, LanguageArchives, Scanned}; use or_job::{Cancel, Progress}; -use super::jobs::{JobKind, RunningJob}; -use super::rpf9_scan::{body_path, Row, View}; -use super::{AppState, DocPayload}; +use crate::state::jobs::{JobKind, RunningJob}; +use crate::state::rpf9_scan::{body_path, Row, View}; +use crate::state::{AppState, DocPayload}; /// The bytes a conversation body, a text table or a sounds body is read to. const BODY_LIMIT: u64 = 64 << 20; @@ -234,7 +234,7 @@ fn notes() -> MutexGuard<'static, BTreeMap> { /// What opening the metadata body `find` at `path` adds. An RBF0 body is read as its strict /// element tree, and where that fails the body still opens as the lenient reader's tree, under /// a note; a PSO body's dialogue lines are kept. -pub(super) fn opened(path: &Path, find: &Rpf9ScanFind, bytes: &[u8]) { +pub(in crate::state) fn opened(path: &Path, find: &Rpf9ScanFind, bytes: &[u8]) { let Rpf9BodyKind::Zlib(run) = find.kind else { return; }; @@ -269,7 +269,7 @@ fn note_body(body: &[u8]) { /// Keeps the text `table` holds of each line found so far and of each key a view asked for, /// where none is kept yet. -pub(super) fn note_table(table: &TextTable) { +pub(in crate::state) fn note_table(table: &TextTable) { let mut lines = lines(); let keys = lines.keys(); let kept = lines.texts.entry(OPENED.to_string()).or_default(); @@ -351,7 +351,7 @@ pub(crate) fn radio_of(path: &Path, data: &AudioData) -> Arc bool { } /// The index still running, as the job list draws it. -pub(super) fn job() -> Option { +pub(in crate::state) fn job() -> Option { let indexing = indexing(); let run = indexing.as_ref()?; Some(RunningJob { @@ -474,7 +474,7 @@ pub(super) fn job() -> Option { } /// Ask the index to stop. -pub(super) fn stop() { +pub(in crate::state) fn stop() { if let Some(run) = indexing().as_ref() { run.cancel.set(); } @@ -570,7 +570,8 @@ fn index( let file = open(archive)?; for &(at, flags, streams) in &archive.containers { steps.step()?; - let Ok(words) = super::gta6_audio_links::stream_words(&file, at, flags, streams) else { + let Ok(words) = crate::state::gta6_audio_links::stream_words(&file, at, flags, streams) + else { continue; }; for id in words.iter().map(|w| w & STREAM_ID) { @@ -660,7 +661,7 @@ fn index( .filter_map(|key| kept.get(key)) .map(|text| audio_radio::name_of_text(&plain(text))) .collect(); - let vocabulary = super::gta6_names::vocabulary(); + let vocabulary = crate::state::gta6_names::vocabulary(); let known = vocabulary.names().chain(named.iter().map(String::as_str)); let station_names = audio_radio::station_names(&stations, known); @@ -741,5 +742,4 @@ impl AppState { } #[cfg(test)] -#[path = "gta6_dialogue_tests.rs"] mod tests; diff --git a/src/state/gta6_dialogue_tests.rs b/src/state/gta6/audio/gta6_dialogue/tests.rs similarity index 100% rename from src/state/gta6_dialogue_tests.rs rename to src/state/gta6/audio/gta6_dialogue/tests.rs diff --git a/src/state/gta6_text.rs b/src/state/gta6/audio/gta6_text.rs similarity index 98% rename from src/state/gta6_text.rs rename to src/state/gta6/audio/gta6_text.rs index a42798c47..53c455e64 100644 --- a/src/state/gta6_text.rs +++ b/src/state/gta6/audio/gta6_text.rs @@ -11,7 +11,7 @@ use or_io::gta6::audio_data::{AudioData, AudioFields, AudioItem}; use or_io::gta6::audio_links::{layout, ItemLayout}; use or_io::gta6::text::{Rewrite, TextItem, TextTable}; -use super::document::DocPayload; +use crate::state::document::DocPayload; /// A text table and the row each text has in the view: its entry, and its form in a variant entry. #[derive(Debug, Clone)] @@ -142,7 +142,9 @@ fn rows_of(table: &TextTable) -> Vec<(usize, Option)> { } /// The text table row's `edited_sections`: the table over its own section, once a text was changed. -pub(super) fn edited_sections(payload: &DocPayload) -> Option> { +pub(in crate::state) fn edited_sections( + payload: &DocPayload, +) -> Option> { let DocPayload::Gta6Text(doc) = payload else { return None; }; @@ -172,7 +174,7 @@ pub struct Gta6AudioDocument { pub groups: Vec<(Option, Vec)>, pub selected: Option, /// The last look for what the body links to in the scan of its archive. - pub linking: Option>, + pub linking: Option>, } impl Gta6AudioDocument { diff --git a/src/state/gta6/audio/mod.rs b/src/state/gta6/audio/mod.rs new file mode 100644 index 000000000..d5332a114 --- /dev/null +++ b/src/state/gta6/audio/mod.rs @@ -0,0 +1,3 @@ +pub(crate) mod gta6_audio_links; +pub(crate) mod gta6_dialogue; +pub(crate) mod gta6_text; diff --git a/src/state/gta6_meta_save.rs b/src/state/gta6/bodies/gta6_meta_save/mod.rs similarity index 95% rename from src/state/gta6_meta_save.rs rename to src/state/gta6/bodies/gta6_meta_save/mod.rs index fd8a9b495..53e9701c6 100644 --- a/src/state/gta6_meta_save.rs +++ b/src/state/gta6/bodies/gta6_meta_save/mod.rs @@ -9,13 +9,12 @@ use or_io::container::rpf::{GtaViKeys, Rpf9Sections}; use or_io::meta::binary::pso::table_strings; use or_io::meta::binary::ContainerLayout; -use super::document::{meta_schema, DocPayload, MetaDocument}; -use super::extract_job::{ExtractItem, OnClash}; -use super::gta6_resource_save::EditedSave; -use super::{AppState, DocumentId}; +use crate::state::document::{meta_schema, DocPayload, MetaDocument}; +use crate::state::extract_job::{ExtractItem, OnClash}; +use crate::state::gta6_resource_save::EditedSave; +use crate::state::{AppState, DocumentId}; -#[path = "gta6_data_xml_splice.rs"] -pub(super) mod splice; +pub(crate) mod splice; /// The bytes `meta` saves as, a table-form PSO's new texts enciphered with the keys `keys` loads. // `keys` is called only when the write needs to encipher a text, which only the writer knows. @@ -52,7 +51,9 @@ pub(crate) fn meta_bytes( } /// The metadata row's `edited_sections`: a headerless resource's, once it is edited, written as a loose resource on the save's worker. -pub(super) fn edited_sections(payload: &DocPayload) -> Option> { +pub(in crate::state) fn edited_sections( + payload: &DocPayload, +) -> Option> { let DocPayload::Meta(meta) = payload else { return None; }; @@ -60,7 +61,7 @@ pub(super) fn edited_sections(payload: &DocPayload) -> Option = Arc::new(move || { + let write: Arc = Arc::new(move || { let sections: Rpf9Sections = meta.headerless_sections().unwrap_or_else(|| { Err("the document is no longer a headerless resource".to_string()) })?; @@ -72,7 +73,7 @@ pub(super) fn edited_sections(payload: &DocPayload) -> Option = Arc::new(move || { + let write: Arc = Arc::new(move || { let mut meta = meta.clone(); meta.ensure_text_current(); - meta_bytes(&meta, || super::rpf9_scan::rpf9_table::keys().ok()) + meta_bytes(&meta, || crate::state::rpf9_scan::rpf9_table::keys().ok()) }); let item = ExtractItem::written(name.clone(), write); Some(self.start_scanned_extraction(name, dest, reads, vec![item], OnClash::Save)) diff --git a/src/state/gta6_data_xml_splice.rs b/src/state/gta6/bodies/gta6_meta_save/splice.rs similarity index 100% rename from src/state/gta6_data_xml_splice.rs rename to src/state/gta6/bodies/gta6_meta_save/splice.rs diff --git a/src/state/gta6_other_bodies.rs b/src/state/gta6/bodies/gta6_other_bodies/mod.rs similarity index 97% rename from src/state/gta6_other_bodies.rs rename to src/state/gta6/bodies/gta6_other_bodies/mod.rs index abba3a1e7..a099f6139 100644 --- a/src/state/gta6_other_bodies.rs +++ b/src/state/gta6/bodies/gta6_other_bodies/mod.rs @@ -13,10 +13,9 @@ use or_io::gta6::other_bodies::{ }; use or_io::mrf::{Operation, Operator}; -use super::document::DocPayload; -use super::rpf9_scan::View; +use crate::state::document::DocPayload; +use crate::state::rpf9_scan::View; -#[path = "gta6_move_nodes.rs"] pub(crate) mod nodes; /// What the scan's list calls the body. @@ -33,7 +32,7 @@ pub(crate) fn label(body: OtherBody) -> &'static str { } /// The view the body opens in; an `EDUP` body's payload is refused there, under its head. -pub(super) fn view(body: OtherBody) -> Result { +pub(in crate::state) fn view(body: OtherBody) -> Result { Ok(View::Identified(body)) } @@ -55,7 +54,7 @@ fn edup_lines(head: &EdupHead) -> Vec { } /// The extension of the path the body opens under. -pub(super) fn ext(body: OtherBody) -> &'static str { +pub(in crate::state) fn ext(body: OtherBody) -> &'static str { match body { OtherBody::HeightMap | OtherBody::HeightGrid => "hmap", OtherBody::Gfx => "gfx", @@ -64,7 +63,11 @@ pub(super) fn ext(body: OtherBody) -> &'static str { } /// The body's payload: GTA V's height map and Scaleform views, the lines of its facts, or an `EDUP` head's lines as the refusal its bytes show under. -pub(super) fn payload(path: &Path, body: OtherBody, bytes: &[u8]) -> Result { +pub(in crate::state) fn payload( + path: &Path, + body: OtherBody, + bytes: &[u8], +) -> Result { let refused = |e: or_io::Error| { tr!( "The reader of this {what} does not read it: {e}", @@ -101,9 +104,9 @@ pub(super) fn payload(path: &Path, body: OtherBody, bytes: &[u8]) -> Result super::gta6_object_trees::lines(bytes)?, + OtherBody::ObjectTrees => crate::state::gta6_object_trees::lines(bytes)?, }; - Ok(super::document_io::text_payload( + Ok(crate::state::document_io::text_payload( path, facts.join("\n").into_bytes(), )) @@ -152,7 +155,7 @@ fn move_lines(outline: &MoveOutline) -> Vec { let mut lines = vec![ tr!( "A GTA VI MoVE network at version 0x13 whose name hash is {hash}: lists of {a}, {b} and {d} entries, then a root node of type {kind}, index {index} and id {id}.", - hash = super::gta6_names::said32(head.name_hash), + hash = crate::state::gta6_names::said32(head.name_hash), a = head.list_a.len(), b = head.list_b.len(), d = head.list_d.len(), @@ -464,7 +467,7 @@ fn named(hash: u32) -> String { /// The name the harvested text holds for `hash`, marked as from the text. fn text_name(hash: u32) -> Option { - super::gta6_names::name32(hash).map(|name| from_the_text(&name)) + crate::state::gta6_names::name32(hash).map(|name| from_the_text(&name)) } fn from_the_text(name: &str) -> String { diff --git a/src/state/gta6_move_nodes.rs b/src/state/gta6/bodies/gta6_other_bodies/nodes.rs similarity index 100% rename from src/state/gta6_move_nodes.rs rename to src/state/gta6/bodies/gta6_other_bodies/nodes.rs diff --git a/src/state/height_map_cell.rs b/src/state/gta6/bodies/gta6_other_bodies_save/cell.rs similarity index 100% rename from src/state/height_map_cell.rs rename to src/state/gta6/bodies/gta6_other_bodies_save/cell.rs diff --git a/src/state/gta6_other_bodies_save.rs b/src/state/gta6/bodies/gta6_other_bodies_save/mod.rs similarity index 95% rename from src/state/gta6_other_bodies_save.rs rename to src/state/gta6/bodies/gta6_other_bodies_save/mod.rs index f4081b4ee..5663395d7 100644 --- a/src/state/gta6_other_bodies_save.rs +++ b/src/state/gta6/bodies/gta6_other_bodies_save/mod.rs @@ -5,10 +5,9 @@ use std::sync::Arc; use or_io::gta6::other_bodies::{Gta6HeightGrid, Gta6HeightMap, OtherBody}; -use super::document::{DocPayload, Document}; -use super::gta6_resource_save::EditedSave; +use crate::state::document::{DocPayload, Document}; +use crate::state::gta6_resource_save::EditedSave; -#[path = "height_map_cell.rs"] mod cell; /// A file's bytes, made on the worker that writes them. @@ -16,17 +15,17 @@ pub type Write = dyn Fn() -> Result, String> + Send + Sync; /// The height map row's `edited_sections` where `document` is an edited height map a GTA VI scan /// found; `None` for any other. -pub(super) fn edited(document: &Document) -> Option> { +pub(in crate::state) fn edited(document: &Document) -> Option> { let DocPayload::HeightMap(grid) = &document.payload else { return None; }; if !document.dirty { return None; } - let (archive, offset) = super::rpf9_scan::scanned_body(document.path.as_deref()?)?; + let (archive, offset) = crate::state::rpf9_scan::scanned_body(document.path.as_deref()?)?; let (archive, grid) = (archive.to_path_buf(), grid.clone()); let write: Arc = Arc::new(move || { - let stored = super::rpf9_scan::extracted_body(&archive, offset)?; + let stored = crate::state::rpf9_scan::extracted_body(&archive, offset)?; if OtherBody::of(&stored, stored.len() as u64) == Some(OtherBody::HeightGrid) { let mut body = Gta6HeightGrid::open(&stored).map_err(|e| e.to_string())?; body.set_height_map(&grid).map_err(|e| e.to_string())?; diff --git a/src/state/gta6_resource.rs b/src/state/gta6/bodies/gta6_resource.rs similarity index 95% rename from src/state/gta6_resource.rs rename to src/state/gta6/bodies/gta6_resource.rs index 79a469e83..32601079f 100644 --- a/src/state/gta6_resource.rs +++ b/src/state/gta6/bodies/gta6_resource.rs @@ -44,7 +44,7 @@ pub(crate) fn role_name(role: Option) -> &'static str { } /// What the reader reads from `bytes`, a read of `resource`: its virtual, then its physical section. -pub(super) fn facts( +pub(in crate::state) fn facts( resource: &Rpf9Resource, signature: Rpf9Signature, bytes: &[u8], @@ -105,7 +105,7 @@ pub(super) fn facts( )); lines.push(tr!("Each structure's nodes are the console driver's, so no geometry is read from them.").to_string()); } - Resource::MorphTarget(m) => super::gta6_morph::morph_lines(&m, &mut lines), + Resource::MorphTarget(m) => crate::state::gta6_morph::morph_lines(&m, &mut lines), Resource::NavMesh(m) => { lines.push(tr!( "A navigation mesh of cell {cell}: {vertices} vertices, {polygons} polygons and {sides} side records, in a quadtree of {nodes} nodes.", @@ -115,7 +115,7 @@ pub(super) fn facts( sides = m.polygons.len().saturating_sub(m.polygons_proper), nodes = m.nodes, )); - lines.extend(super::gta6_navmesh::cell_lines(&m)); + lines.extend(crate::state::gta6_navmesh::cell_lines(&m)); } Resource::NavOctree(t) => lines.push(tr!( "A navigation octree of cell {cell}: {nodes} nodes, {internal} of them internal, and {placeholder} placeholder, {open} open and {surface} surface leaves.", @@ -126,7 +126,7 @@ pub(super) fn facts( open = t.open, surface = t.surface, )), - Resource::Cloth(c) => super::gta6_fragment::cloth_lines(&c, &mut lines), + Resource::Cloth(c) => crate::state::gta6_fragment::cloth_lines(&c, &mut lines), Resource::VertexBuffers(set) => lines.push(tr!( "{buffers} vertex buffers of {vertices} vertices in all, with no index buffer: which drawable's they are is not known.", buffers = set.buffers.len(), @@ -137,10 +137,10 @@ pub(super) fn facts( size = or_job::human_bytes(b.len), key = format!("{:016X}", b.key), )), - Resource::KeyedBlobDescriptor(d) => super::gta6_small::descriptor_lines(&d, &mut lines), - Resource::AssetIndex(a) => super::gta6_small::index_lines(&a, &mut lines), - Resource::NeighbourTable(n) => super::gta6_small::neighbour_lines(&n, &mut lines), - Resource::ParticleEffects(list) => lines.extend(super::gta6_particles::lines(&list)), + Resource::KeyedBlobDescriptor(d) => crate::state::gta6_small::descriptor_lines(&d, &mut lines), + Resource::AssetIndex(a) => crate::state::gta6_small::index_lines(&a, &mut lines), + Resource::NeighbourTable(n) => crate::state::gta6_small::neighbour_lines(&n, &mut lines), + Resource::ParticleEffects(list) => lines.extend(crate::state::gta6_particles::lines(&list)), } Ok(lines.join("\n")) } @@ -195,7 +195,7 @@ fn record_lines(name: &str, bones: &[or_io::gta6::headerless::BoneRecord]) -> St let values: Vec = b.values.iter().map(f32::to_string).collect(); tr!( "Bone {bone}: kind {kind}, flags {flags}, values {values}.", - bone = super::gta6_names::said32(b.bone), + bone = crate::state::gta6_names::said32(b.bone), kind = b.kind, flags = format!("{:#010X}", b.flags), values = values.join(", "), @@ -211,13 +211,13 @@ fn fragment_lines(r: &DrawableWithBound, shaders: bool, lines: &mut Vec) Some(bound) => bound_lines(bound, false, lines), None => lines.push(tr!("It has no bound: its record at 0x10 is null.").to_string()), } - super::gta6_fragment::fragment_lines(&r.fragment, lines); + crate::state::gta6_fragment::fragment_lines(&r.fragment, lines); } /// The drawable a scanned body shows: its own, its fragment's, or the dictionary entry `selection` names. pub(crate) fn drawable_of( resource: &Resource, - selection: Option, + selection: Option, ) -> Option<&Drawable> { match resource { Resource::Drawable(d) => Some(d), @@ -251,7 +251,7 @@ pub(crate) fn dictionary_drawables( /// shows, whose shaders it lists as [`material_rows`]. pub(crate) fn body_lines( resource: &Resource, - selection: Option, + selection: Option, ) -> Vec { let mut lines = Vec::new(); match resource { @@ -269,7 +269,7 @@ pub(crate) fn body_lines( } } Resource::Drawable(d) => drawable_lines(d, false, &mut lines), - Resource::Cloth(c) => super::gta6_fragment::cloth_lines(c, &mut lines), + Resource::Cloth(c) => crate::state::gta6_fragment::cloth_lines(c, &mut lines), _ => {} } lines @@ -299,7 +299,7 @@ fn texture_line(t: &DictionaryTexture) -> String { /// A scanned navigation mesh as the model the `.ynv` view draws, the cell kept for the inspector /// under `path`; `None` where it does not read or fit. -pub(super) fn as_ynv( +pub(in crate::state) fn as_ynv( path: &std::path::Path, resource: &Rpf9Resource, signature: Rpf9Signature, @@ -310,19 +310,19 @@ pub(super) fn as_ynv( } let m = read_navmesh(resource.sections(bytes).0).ok()?; let mesh = cell_view(&m)?; - super::gta6_navmesh::remember(path, m); + crate::state::gta6_navmesh::remember(path, m); Some(mesh) } /// A cell as the model the `.ynv` view draws; `None` where it does not fit. -pub(super) fn cell_view(m: &or_io::gta6::headerless::NavMesh) -> Option { +pub(in crate::state) fn cell_view(m: &or_io::gta6::headerless::NavMesh) -> Option { let vertices = (m.vertices.iter()).map(|q| CNavMeshCompressedVertex { data: *q, ..Default::default() }); // ⚠ GTA V's edge names a polygon in fifteen bits: one past them leads nowhere in the view. - let edges = (0..m.edges.len()).map(|i| super::gta6_navmesh_edit::view_edge(m, i)); - let mut runs = super::gta6_navmesh::link_runs(m); + let edges = (0..m.edges.len()).map(|i| crate::state::gta6_navmesh_edit::view_edge(m, i)); + let mut runs = crate::state::gta6_navmesh::link_runs(m); let mut polygons = Vec::with_capacity(m.polygons.len()); for (p, run) in m.polygons.iter().zip(&mut runs) { let mut polygon = TNavMeshPoly { @@ -550,7 +550,7 @@ static KEPT_STATE: Mutex = Mutex::new(KeptState { // ⚠ Named anew when a kept effect gains a field an older file lacks: `gta6_effects.json` predates // each constant's drawable place, which an absent value cannot tell from a buffer the engine fills. fn kept_effects_path() -> Option { - super::prefs::config_root().map(|root| root.join("gta6_effects_placed.json")) + crate::state::prefs::config_root().map(|root| root.join("gta6_effects_placed.json")) } fn effects() -> MutexGuard<'static, EffectsCache> { @@ -570,7 +570,7 @@ fn effects() -> MutexGuard<'static, EffectsCache> { /// Whether the effects an earlier run kept have been read; the first call for a config folder starts reading them on a worker. /// /// ⚠ The kept file is tens of megabytes of JSON: read on the UI thread it held a frame half a second. -pub(super) fn kept_effects_ready() -> bool { +pub(in crate::state) fn kept_effects_ready() -> bool { let path = kept_effects_path(); let mut kept = KEPT_STATE .lock() @@ -604,7 +604,7 @@ fn keep_effects(path: &std::path::Path, text: serde_json::Result) -> Res } /// Whether the app knows any GTA VI effect, read this run or kept from an earlier one. -pub(super) fn effects_known() -> bool { +pub(in crate::state) fn effects_known() -> bool { effects() .defs .as_ref() @@ -627,7 +627,10 @@ pub(crate) fn effect_def(hash: u32) -> Option { } /// Keep the effects of `bytes`, an `SGD5` container, for the drawables' shaders; how many it holds. -pub(super) fn learn_effects(bytes: &[u8], platform: or_io::Platform) -> Result { +pub(in crate::state) fn learn_effects( + bytes: &[u8], + platform: or_io::Platform, +) -> Result { let file = Sgd5File::open(bytes, platform).map_err(|e| e.to_string())?; let learned = shader_definitions("gta6", "gta6", std::slice::from_ref(&file)); let count = learned.shaders.len(); @@ -650,11 +653,11 @@ pub(super) fn learn_effects(bytes: &[u8], platform: or_io::Platform) -> Result u64 { +pub(crate) fn drawable_lines_stamp(state: &crate::state::AppState) -> u64 { let mut hasher = DefaultHasher::new(); EFFECTS_LEARNED.load(Ordering::Relaxed).hash(&mut hasher); shader_defs::is_installed().hash(&mut hasher); - super::ttpf_document::names_known().hash(&mut hasher); + crate::state::ttpf_document::names_known().hash(&mut hasher); state.texture_packs_indexed().hash(&mut hasher); for doc in &state.documents { (doc.id, doc.payload_epoch()).hash(&mut hasher); @@ -664,7 +667,7 @@ pub(crate) fn drawable_lines_stamp(state: &super::AppState) -> u64 { /// The name a texture key is looked up and drawn by: the one the app has learned, else `hash_` and the key. pub(crate) fn texture_name(key: u64) -> String { - super::ttpf_document::known_name(key) + crate::state::ttpf_document::known_name(key) .map_or_else(|| format!("hash_{key:016X}"), |n| n.to_ascii_lowercase()) } @@ -689,8 +692,8 @@ pub(crate) type Material = (String, Vec<(String, String, bool)>); /// effect, then a row per parameter, a texture with what its key resolves to as the model view /// binds it, a constant with its words and place. pub(crate) fn material_rows( - state: &super::AppState, - doc: super::DocumentId, + state: &crate::state::AppState, + doc: crate::state::DocumentId, d: &Drawable, ) -> Vec { let names = gta5_names(); @@ -760,8 +763,8 @@ pub(crate) fn material_rows( /// it resolves, or that none holds it. A key no pack of its install holds is no warning: nothing /// the reader does would load it. fn texture_detail( - state: &super::AppState, - doc: super::DocumentId, + state: &crate::state::AppState, + doc: crate::state::DocumentId, slot: usize, key: Option, ) -> (String, bool) { @@ -769,7 +772,7 @@ fn texture_detail( return (tr!("texture slot {slot} · unbound", slot = slot), false); }; let known = texture_name(key); - let found = super::texture_resolution::probe(state, None, None, &known).found; + let found = crate::state::texture_resolution::probe(state, None, None, &known).found; let name = match known.starts_with("hash_") { true => known.clone(), false => format!("{known} ({key:016X})"), @@ -808,7 +811,7 @@ fn texture_detail( /// hex elsewhere, beside the effect's default where it sets one; and whether a known effect leaves /// it undeclared. fn constant_values(words: &[u32], effect: Option<&ShaderDef>, hash: u32) -> (String, bool) { - use super::gta6_constant_types as types; + use crate::state::gta6_constant_types as types; use or_io::gta5::shaders::shader_defs::ShaderParamValue; let def = effect.map(|e| drawable_parameter(e, hash)); let declared = def.flatten(); @@ -986,7 +989,7 @@ fn drawable_lines(d: &Drawable, shaders: bool, lines: &mut Vec) { lines.extend( d.embedded .as_deref() - .map(super::gta6_fragment::surfaces_line), + .map(crate::state::gta6_fragment::surfaces_line), ); lines.extend(refused); } diff --git a/src/state/gta6_awc_in_extent.rs b/src/state/gta6/bodies/gta6_resource_save/awc_in_extent.rs similarity index 100% rename from src/state/gta6_awc_in_extent.rs rename to src/state/gta6/bodies/gta6_resource_save/awc_in_extent.rs diff --git a/src/state/gta6_resource_save.rs b/src/state/gta6/bodies/gta6_resource_save/mod.rs similarity index 86% rename from src/state/gta6_resource_save.rs rename to src/state/gta6/bodies/gta6_resource_save/mod.rs index 88b8fa8f3..9f52b8da0 100644 --- a/src/state/gta6_resource_save.rs +++ b/src/state/gta6/bodies/gta6_resource_save/mod.rs @@ -10,12 +10,11 @@ use std::sync::Arc; use or_io::container::rpf::Rpf9Sections; -use super::capabilities::EditedSectionsFn; -use super::extract_job::{ExtractItem, OnClash}; -use super::gta6_edit::EditSections; -use super::{AppState, DocumentId, GateOutcome, PendingRetailEdit, PendingRetailEditPrompt}; +use crate::state::capabilities::EditedSectionsFn; +use crate::state::extract_job::{ExtractItem, OnClash}; +use crate::state::gta6_edit::EditSections; +use crate::state::{AppState, DocumentId, GateOutcome, PendingRetailEdit, PendingRetailEditPrompt}; -#[path = "gta6_awc_in_extent.rs"] mod awc_in_extent; /// What a save writes of a GTA VI resource document's edits. @@ -29,18 +28,20 @@ pub enum EditedSave { edit: Arc, }, /// A file's bytes, which its kind's own writer makes on the worker. - Written(Arc), + Written(Arc), /// A whole file the document wrote, such as an audio container with a stream replaced. Bytes(Vec), } /// The audio container row's `edited_sections`: the container laid in its extents, else rewritten. -pub(super) fn edited_awc(doc: &super::Document) -> Option> { +pub(in crate::state) fn edited_awc( + doc: &crate::state::Document, +) -> Option> { awc_in_extent::edited(doc) } /// A row's `edited_sections` of the sections a payload holds edited. -pub(super) fn held( +pub(in crate::state) fn held( sections: Option>, ) -> Option> { sections.map(|s| s.map(EditedSave::Sections)) @@ -49,21 +50,24 @@ pub(super) fn held( /// The GTA VI drawable row's `edited_sections`: its materials, physics, bones and embedded /// textures edited in place, then its geometry replaced from glTF, then one geometry at a time. #[cfg(not(test))] -pub(super) const DRAWABLE: Option = - Some(super::gta6_modding::model_replace::edited_save); +pub(in crate::state) const DRAWABLE: Option = + Some(crate::state::gta6_modding::model_replace::edited_save); #[cfg(test)] -pub(super) const DRAWABLE: Option = Some(tests::held); +pub(in crate::state) const DRAWABLE: Option = Some(tests::held); impl AppState { /// What a save writes of document `doc`'s edits, from its row; `None` while it holds none. - pub(super) fn edited_sections(&self, doc: DocumentId) -> Option> { + pub(in crate::state) fn edited_sections( + &self, + doc: DocumentId, + ) -> Option> { let doc = self.document(doc)?; - (super::capabilities::for_payload(&doc.payload)?.edited_sections?)(doc) + (crate::state::capabilities::for_payload(&doc.payload)?.edited_sections?)(doc) } /// `name` in `dest`, the edits of `doc` written as a loose resource on a worker; `None` while /// it holds none, and `Some(false)` where they cannot be written. - pub(super) fn save_edited_sections( + pub(in crate::state) fn save_edited_sections( &mut self, doc: DocumentId, dest: PathBuf, @@ -72,8 +76,8 @@ impl AppState { ) -> Option { let edited = self.edited_sections(doc)?; // The neighbouring bodies whose links an edit of a scanned cell renumbered. - let beside = - (self.document(doc)).map_or(Vec::new(), super::gta6_navmesh_delete::links::beside); + let beside = (self.document(doc)) + .map_or(Vec::new(), crate::state::gta6_navmesh_delete::links::beside); Some(self.start_edited_save(edited, dest, name, reads, beside)) } @@ -105,12 +109,16 @@ impl AppState { /// Save a copy of the scanned body `doc` shows to `path`: a metadata body as its XML where /// `path` ends in `.xml`, any other as a file that opens again; `None` for any other document. - pub(super) fn save_scanned_body_as(&mut self, doc: DocumentId, path: &Path) -> Option { + pub(in crate::state) fn save_scanned_body_as( + &mut self, + doc: DocumentId, + path: &Path, + ) -> Option { let id = doc; let xml = (path.extension()).is_some_and(|e| e.eq_ignore_ascii_case("xml")); let over_archive = (self.document(id).and_then(|d| d.path.as_deref())) - .and_then(super::rpf9_scan::scanned_body) - .is_some_and(|(archive, _)| super::reload_open_file::same_file(path, archive)); + .and_then(crate::state::rpf9_scan::scanned_body) + .is_some_and(|(archive, _)| crate::state::reload_open_file::same_file(path, archive)); // An XML export holds no checksum, and a save over the archive is refused below. if !xml && !over_archive { self.say_the_checksum_is_kept(id); @@ -118,21 +126,21 @@ impl AppState { // A form edit reaches the text only as the Text panel draws; an XML save reads the text, // and any other makes it current on its worker. if let Some(doc) = self.document_mut(id).filter(|_| xml) { - if let super::DocPayload::Meta(meta) = &mut doc.payload { + if let crate::state::DocPayload::Meta(meta) = &mut doc.payload { meta.ensure_text_current(); } } let doc = self.document(doc)?; - let (archive, offset) = super::rpf9_scan::scanned_body(doc.path.as_deref()?)?; + let (archive, offset) = crate::state::rpf9_scan::scanned_body(doc.path.as_deref()?)?; let archive = archive.to_path_buf(); let name = path.file_name()?.to_string_lossy().into_owned(); let gxt2 = (path.extension()).is_some_and(|e| e.eq_ignore_ascii_case("gxt2")); // A body shown as the lines its reader reads is never written as those lines. let edited_text = doc.dirty - && matches!(doc.payload, super::DocPayload::Text(_)) - && (doc.path.as_deref()).is_some_and(super::rpf9_scan::opened_as_text); + && matches!(doc.payload, crate::state::DocPayload::Text(_)) + && (doc.path.as_deref()).is_some_and(crate::state::rpf9_scan::opened_as_text); let item = match &doc.payload { - super::DocPayload::Meta(meta) if xml => { + crate::state::DocPayload::Meta(meta) if xml => { // A GTA VI form's name comments are display-only; the file is the comment-free XML. let bytes = match meta.comment_free_xml() { Some(xml) => xml.into_bytes(), @@ -141,11 +149,11 @@ impl AppState { Ok(ExtractItem::bytes(name.clone(), bytes)) } // An edited text body is written in the encoding and line endings it was read with. - super::DocPayload::Text(text) if edited_text => { + crate::state::DocPayload::Text(text) if edited_text => { Ok(ExtractItem::bytes(name.clone(), text.encode())) } // A text table exports as GTA V's text table, as a GTA V one saves. - super::DocPayload::Gta6Text(text) if gxt2 => { + crate::state::DocPayload::Gta6Text(text) if gxt2 => { (text.to_gxt2()).map(|bytes| ExtractItem::bytes(name.clone(), bytes)) } _ => Ok(ExtractItem::scanned(name.clone(), archive.clone(), offset)), @@ -158,7 +166,7 @@ impl AppState { } }; let dest = path.parent()?.to_path_buf(); - if super::reload_open_file::same_file(path, &archive) { + if crate::state::reload_open_file::same_file(path, &archive) { self.show_error_toast(tr!( "A body is saved as a file of its own, never over the archive it is read from." )); @@ -184,7 +192,7 @@ impl AppState { /// Whether `doc` holds edits no writer took, said in a toast: a copy of the stored body would /// drop them without a word. - pub(super) fn refuse_untaken_edits(&mut self, doc: DocumentId) -> bool { + pub(in crate::state) fn refuse_untaken_edits(&mut self, doc: DocumentId) -> bool { if !self.document(doc).is_some_and(|d| d.dirty) { return false; } @@ -196,7 +204,7 @@ impl AppState { /// Save of a loose resource file whose document holds edited sections, over that file once the /// write gate permits it; `None` for any other document, which saves or refuses as it did. - pub(super) fn save_edited_resource(&mut self, doc: DocumentId) -> Option { + pub(in crate::state) fn save_edited_resource(&mut self, doc: DocumentId) -> Option { if self.document(doc)?.read_only.is_none() { self.say_the_checksum_is_kept(doc); } @@ -218,7 +226,7 @@ impl AppState { /// The save [`save_edited_resource`](Self::save_edited_resource) starts once the gate let it /// through; `None` for any other document. - pub(super) fn save_edited_resource_inner(&mut self, doc: DocumentId) -> Option { + pub(in crate::state) fn save_edited_resource_inner(&mut self, doc: DocumentId) -> Option { let path = self.loose_resource_file(doc)?; let edited = self.edited_sections(doc)?; Some(self.write_edited_resource(doc, path, edited)) @@ -228,7 +236,7 @@ impl AppState { fn loose_resource_file(&self, doc: DocumentId) -> Option { let path = self.document(doc)?.path.clone()?; // A body read out of an archive is never saved into it: only a file of its own is. - let (file, 0) = super::rpf9_scan::scanned_body(&path)? else { + let (file, 0) = crate::state::rpf9_scan::scanned_body(&path)? else { return None; }; (file == path.as_path()).then_some(path) @@ -256,11 +264,10 @@ impl AppState { } #[cfg(test)] -#[path = "saving_an_edited_gta_vi_text_body.rs"] mod saving_an_edited_gta_vi_text_body; #[cfg(test)] -pub(super) mod tests { +pub(in crate::state) mod tests { use std::cell::RefCell; use std::io::Cursor; use std::time::{Duration, Instant}; @@ -284,7 +291,7 @@ pub(super) mod tests { return None; }; let sections = HELD.with(|held| held.borrow().clone()); - let edited = || super::super::gta6_gltf_import::edited_save(doc); + let edited = || crate::state::gta6_gltf_import::edited_save(doc); super::held(sections.map(Ok)).or_else(edited) } diff --git a/src/state/saving_an_edited_gta_vi_text_body.rs b/src/state/gta6/bodies/gta6_resource_save/saving_an_edited_gta_vi_text_body.rs similarity index 100% rename from src/state/saving_an_edited_gta_vi_text_body.rs rename to src/state/gta6/bodies/gta6_resource_save/saving_an_edited_gta_vi_text_body.rs diff --git a/src/state/gta6_save.rs b/src/state/gta6/bodies/gta6_save/mod.rs similarity index 99% rename from src/state/gta6_save.rs rename to src/state/gta6/bodies/gta6_save/mod.rs index 98e6f577a..8a9955349 100644 --- a/src/state/gta6_save.rs +++ b/src/state/gta6/bodies/gta6_save/mod.rs @@ -15,9 +15,8 @@ use or_io::gta6::save_crypto::SaveCipher; use or_io::meta::binary::hash_index::default_hash_index; use serde_json::Value; -use super::{AppState, Change, DocPayload, DocumentId, Swap}; +use crate::state::{AppState, Change, DocPayload, DocumentId, Swap}; -#[path = "gta6_save_players.rs"] pub(crate) mod players; pub(crate) use players::{Players, SaveAction}; @@ -386,7 +385,7 @@ impl Gta6SaveDocument { } /// The status line of the row `sel` picks. - pub(crate) fn picked(&self, sel: super::SelectionKey) -> Option { + pub(crate) fn picked(&self, sel: crate::state::SelectionKey) -> Option { let (label, bytes) = self.row(usize::try_from(sel.row()?).ok()?)?; Some(tr_n!( "{row}: {count} byte of JSON", @@ -544,7 +543,7 @@ impl AppState { } /// The status line of the row picked, else what the save is. -pub(crate) fn summary(payload: &DocPayload, sel: super::SelectionKey) -> String { +pub(crate) fn summary(payload: &DocPayload, sel: crate::state::SelectionKey) -> String { let DocPayload::Gta6Save(doc) = payload else { return String::new(); }; @@ -566,7 +565,6 @@ pub(crate) fn member_count(value: &Value) -> Option { } #[cfg(test)] -#[path = "gta6_save_story_tests.rs"] mod story_tests; #[cfg(test)] diff --git a/src/state/gta6_save_players.rs b/src/state/gta6/bodies/gta6_save/players.rs similarity index 100% rename from src/state/gta6_save_players.rs rename to src/state/gta6/bodies/gta6_save/players.rs diff --git a/src/state/gta6_save_story_tests.rs b/src/state/gta6/bodies/gta6_save/story_tests.rs similarity index 100% rename from src/state/gta6_save_story_tests.rs rename to src/state/gta6/bodies/gta6_save/story_tests.rs diff --git a/src/state/gta6/bodies/mod.rs b/src/state/gta6/bodies/mod.rs new file mode 100644 index 000000000..4a0fa9c92 --- /dev/null +++ b/src/state/gta6/bodies/mod.rs @@ -0,0 +1,6 @@ +pub(crate) mod gta6_meta_save; +pub(crate) mod gta6_other_bodies; +pub(crate) mod gta6_other_bodies_save; +pub(crate) mod gta6_resource; +pub(crate) mod gta6_resource_save; +pub(crate) mod gta6_save; diff --git a/src/state/gta6_constant_types.rs b/src/state/gta6/drawable/gta6_constant_types.rs similarity index 92% rename from src/state/gta6_constant_types.rs rename to src/state/gta6/drawable/gta6_constant_types.rs index c3a1939f6..01f649968 100644 --- a/src/state/gta6_constant_types.rs +++ b/src/state/gta6/drawable/gta6_constant_types.rs @@ -5,13 +5,13 @@ use or_io::gta5::shaders::sgd5::remap_table; use or_io::gta5::shaders::shader_defs::{ShaderParamDef, ShaderParamKind}; /// Whether `def` declares type 0x03. -pub(super) fn is_remap(def: &ShaderParamDef) -> bool { +pub(in crate::state) fn is_remap(def: &ShaderParamDef) -> bool { def.kind == ShaderParamKind::Unknown(3) } /// Three words of type 0x03 as their 16 entries: an entry that maps to itself by its index, a /// remapped one as `index→value`, and either followed by `:flag` where its flag is set. -pub(super) fn remap_shown(words: &[u32]) -> Option { +pub(in crate::state) fn remap_shown(words: &[u32]) -> Option { let table = remap_table(<[u32; 3]>::try_from(words).ok()?); let entries: Vec = (table.iter().enumerate()) .map(|(i, &(value, flag))| { @@ -30,7 +30,7 @@ pub(super) fn remap_shown(words: &[u32]) -> Option { /// The words of a constant whose effect declares type 0x00 or 0x0F, in hex, with the declaration /// refused as stale because no drawable holds either type; `None` for any other declaration. -pub(super) fn stale(words: &[u32], def: &ShaderParamDef) -> Option { +pub(in crate::state) fn stale(words: &[u32], def: &ShaderParamDef) -> Option { let code = match def.kind { ShaderParamKind::Bool => 0x00, ShaderParamKind::Unknown(0x0F) => 0x0F, diff --git a/src/state/gta6_edit.rs b/src/state/gta6/drawable/gta6_edit/mod.rs similarity index 88% rename from src/state/gta6_edit.rs rename to src/state/gta6/drawable/gta6_edit/mod.rs index 9392c92ad..76c191ed9 100644 --- a/src/state/gta6_edit.rs +++ b/src/state/gta6/drawable/gta6_edit/mod.rs @@ -17,11 +17,11 @@ use or_io::gta6::headerless::{ write_materials_with, Entry, Parameter, ParameterValue, Resource, Shader, }; -use super::document::Document; -use super::edit_history::Change; -use super::gta6_resource_save::EditedSave; -use super::texture_edit::TextureEdit; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::document::Document; +use crate::state::edit_history::Change; +use crate::state::gta6_resource_save::EditedSave; +use crate::state::texture_edit::TextureEdit; +use crate::state::{AppState, DocPayload, DocumentId}; /// The most bytes a save reads of a body again. const BODY_LIMIT: u64 = 1 << 30; @@ -41,17 +41,17 @@ pub(crate) enum MaterialEdit { /// The 32-bit name hash of the texture `key` names, where the app knows that name or a drawable or a typed name stated it. pub(crate) fn named_word(key: u64) -> Option { - let known = super::ttpf_document::known_name(key) + let known = crate::state::ttpf_document::known_name(key) .filter(|name| name_hash64(name.as_bytes()) == key) .map(|name| name_hash32(name.as_bytes())); - known.or_else(|| super::gta6_key_words::word(key)) + known.or_else(|| crate::state::gta6_key_words::word(key)) } /// The drawable `selection` shows of `resource`, by the code a save finds it under: `None` for its /// own or its fragment's, a dictionary entry's code; `None` outright where it shows none. pub(crate) fn drawable_code( resource: &Resource, - selection: Option, + selection: Option, ) -> Option> { match resource { Resource::Drawable(_) | Resource::DrawableWithBound(_) => Some(None), @@ -72,7 +72,7 @@ pub(crate) fn texture_key(text: &str) -> Option { /// Shader `index` of the drawable `code` finds in `payload`, while no other holder of the body is /// reading it. -pub(super) fn shader_mut( +pub(in crate::state) fn shader_mut( payload: &mut DocPayload, code: Option, index: usize, @@ -141,7 +141,7 @@ impl AppState { MaterialEdit::Constant { .. } => tr!("Set a material value").to_string(), MaterialEdit::TextureKey { key, .. } => tr!( "Bind {name}", - name = super::gta6_resource::texture_name(*key) + name = crate::state::gta6_resource::texture_name(*key) ), }; let document = (self.document_mut(doc)).ok_or_else(|| tr!("its document is closed"))?; @@ -172,7 +172,7 @@ impl AppState { /// Whether `doc` is a scanned GTA VI texture dictionary, shown as a Legacy one. pub(crate) fn is_scanned_dictionary(doc: &Document) -> bool { - doc.read_only == Some(super::rpf9_scan::READ_ONLY_BODY) + doc.read_only == Some(crate::state::rpf9_scan::READ_ONLY_BODY) && matches!( doc.payload, DocPayload::Resource(or_io::Asset::TextureDict(_)) @@ -181,7 +181,7 @@ pub(crate) fn is_scanned_dictionary(doc: &Document) -> bool { /// Texture `name` of the scanned GTA VI dictionary `doc` replaced from `image` in its own size, /// format and mips: the texture it held and what changed; `None` for any other document. -pub(super) fn replace_scanned_texture( +pub(in crate::state) fn replace_scanned_texture( doc: &mut Document, name: &str, image: &RgbaImage, @@ -192,12 +192,12 @@ pub(super) fn replace_scanned_texture( return None; } // An array's or a cube's slice is replaced alone: the one the preview shows. - let shown = super::ttpf_document::shown_scanned_slice(doc, name); + let shown = crate::state::ttpf_document::shown_scanned_slice(doc, name); let slices = match &doc.payload { DocPayload::Resource(or_io::Asset::TextureDict(dict)) => dict.get(name), _ => None, }; - let slices = slices.map(|t| super::ttpf_document::scanned_slices(doc, t)); + let slices = slices.map(|t| crate::state::ttpf_document::scanned_slices(doc, t)); let DocPayload::Resource(or_io::Asset::TextureDict(dict)) = &mut doc.payload else { return None; }; @@ -229,14 +229,14 @@ fn replaced_slice( options: &TextureBuildOptions, ) -> Result { let slice = slice.min(slices.saturating_sub(1)); - let mut one = super::ttpf_document::scanned_slice(texture.clone(), slice, slices); + let mut one = crate::state::ttpf_document::scanned_slice(texture.clone(), slice, slices); replaced(&mut one, image, format, options)?; // `replaced` keeps the slice's length, and the slices fit the texture's store whole. let each = one.backing_store.len(); let at = each * slice as usize; let before = texture.clone(); texture.backing_store[at..at + each].copy_from_slice(&one.backing_store); - if texture.image_type == super::ttpf_document::VOLUME_IMAGE { + if texture.image_type == crate::state::ttpf_document::VOLUME_IMAGE { shared_planes(texture, slice as usize, slices as usize, each); } Ok(before) @@ -265,7 +265,7 @@ fn shared_planes(texture: &mut GrcTexture, slice: usize, slices: usize, each: us } /// `texture` encoded from `image` in its own size, format and mips; the texture it was. -pub(super) fn replaced( +pub(in crate::state) fn replaced( texture: &mut GrcTexture, image: &RgbaImage, format: FormatChoice, @@ -325,31 +325,33 @@ pub(super) fn replaced( /// The GTA VI drawable and texture dictionary rows' `edited_sections` where `document` holds a GTA /// VI edit: its body read again on the worker and written over with the values it shows; `None` /// where it holds none. -pub(super) fn edited_save(document: &Document) -> Option> { +pub(in crate::state) fn edited_save(document: &Document) -> Option> { if !document.history.can_undo() { return None; } - let (archive, offset) = super::rpf9_scan::scanned_body(document.path.as_deref()?)?; + let (archive, offset) = crate::state::rpf9_scan::scanned_body(document.path.as_deref()?)?; let edit: Arc = match &document.payload { DocPayload::Gta6Drawable(resource) => { let drawables = shaders_of(resource); - let filters = super::gta6_filter_edit::values_of(resource); - let entries = super::gta6_filter_entries::entries_of(resource); + let filters = crate::state::gta6_filter_edit::values_of(resource); + let entries = crate::state::gta6_filter_entries::entries_of(resource); Arc::new(move |role, sections| { let role = role.ok_or_else(|| tr!("The body's role is not known.").to_string())?; for (code, shaders) in &drawables { write_materials_with(role, sections, *code, shaders, &named_word) .map_err(|e| e.to_string())?; } - super::gta6_filter_entries::add_and_remove(sections, &entries, &filters)?; - super::gta6_filter_edit::write(sections, &filters) + crate::state::gta6_filter_entries::add_and_remove(sections, &entries, &filters)?; + crate::state::gta6_filter_edit::write(sections, &filters) }) } DocPayload::Resource(or_io::Asset::TextureDict(dict)) if is_scanned_dictionary(document) => { - let textures = super::gta6_dictionary_write::held(dict); - Arc::new(move |_, sections| super::gta6_dictionary_write::write(sections, &textures)) + let textures = crate::state::gta6_dictionary_write::held(dict); + Arc::new(move |_, sections| { + crate::state::gta6_dictionary_write::write(sections, &textures) + }) } _ => return None, }; @@ -365,7 +367,7 @@ fn shaders_of(resource: &Resource) -> Vec<(Option, Vec)> { match resource { Resource::Drawable(d) => vec![(None, d.shaders.clone())], Resource::DrawableWithBound(r) => vec![(None, r.drawable.shaders.clone())], - Resource::Dictionary(_) => super::gta6_resource::dictionary_drawables(resource) + Resource::Dictionary(_) => crate::state::gta6_resource::dictionary_drawables(resource) .map(|(code, d)| (Some(code), d.shaders.clone())) .collect(), _ => Vec::new(), @@ -373,7 +375,11 @@ fn shaders_of(resource: &Resource) -> Vec<(Option, Vec)> { } /// The body at `offset` of `archive` read again, `edit` made to its sections, as a loose resource. -pub(super) fn written(archive: &Path, offset: u64, edit: &EditSections) -> Result, String> { +pub(in crate::state) fn written( + archive: &Path, + offset: u64, + edit: &EditSections, +) -> Result, String> { let file = std::fs::File::open(archive).map_err(|e| format!("{}: {e}", archive.display()))?; let (find, bytes) = read_rpf9_body(&file, offset, BODY_LIMIT).map_err(|e| e.to_string())?; let mut sections = Rpf9Sections::of(&find, &bytes).ok_or_else(|| { @@ -388,5 +394,4 @@ pub(super) fn written(archive: &Path, offset: u64, edit: &EditSections) -> Resul } #[cfg(test)] -#[path = "gta6_edit_tests.rs"] -pub(super) mod tests; +pub(crate) mod tests; diff --git a/src/state/gta6_edit_tests.rs b/src/state/gta6/drawable/gta6_edit/tests.rs similarity index 99% rename from src/state/gta6_edit_tests.rs rename to src/state/gta6/drawable/gta6_edit/tests.rs index 3514b346c..25b6e6ef9 100644 --- a/src/state/gta6_edit_tests.rs +++ b/src/state/gta6/drawable/gta6_edit/tests.rs @@ -98,7 +98,7 @@ fn opened(state: &mut AppState, path: PathBuf, not: DocumentId) -> DocumentId { /// The texture key of `name`, which the app then knows by that name. fn known(name: &str) -> u64 { let key = or_io::gta6::hash::name_hash64(name.as_bytes()); - super::super::ttpf_document::learn_named([(key, name.to_string())]); + crate::state::ttpf_document::learn_named([(key, name.to_string())]); key } diff --git a/src/state/gta6_effect_facts.rs b/src/state/gta6/drawable/gta6_effect_facts.rs similarity index 97% rename from src/state/gta6_effect_facts.rs rename to src/state/gta6/drawable/gta6_effect_facts.rs index 894067992..5843daac8 100644 --- a/src/state/gta6_effect_facts.rs +++ b/src/state/gta6/drawable/gta6_effect_facts.rs @@ -6,11 +6,11 @@ use std::path::Path; use or_io::gta5::shaders::sgd5::{Sgd5Effect, Sgd5File, Sgd5Table, BANKS}; -use super::document::DocPayload; +use crate::state::document::DocPayload; /// The container in `bytes` as its lines; the job its row starts learns its effects for the /// drawables' shaders. -pub(super) fn payload( +pub(in crate::state) fn payload( path: &Path, platform: or_io::Platform, bytes: &[u8], @@ -18,7 +18,10 @@ pub(super) fn payload( let file = Sgd5File::open(bytes, platform) .map_err(|e| tr!("GTA VI's SGD5 reader does not read this body: {e}", e = e))?; let text = lines(&file).join("\n"); - Ok(super::document_io::text_payload(path, text.into_bytes())) + Ok(crate::state::document_io::text_payload( + path, + text.into_bytes(), + )) } fn or_unknown(value: Option) -> String { diff --git a/src/state/gta6_effects.rs b/src/state/gta6/drawable/gta6_effects.rs similarity index 87% rename from src/state/gta6_effects.rs rename to src/state/gta6/drawable/gta6_effects.rs index 7d71def4b..328e0bf62 100644 --- a/src/state/gta6_effects.rs +++ b/src/state/gta6/drawable/gta6_effects.rs @@ -9,8 +9,8 @@ use std::sync::{Arc, Mutex}; use or_io::container::rpf::{read_rpf9_body, Rpf9ScanFind}; use or_job::{Cancel, Progress}; -use super::jobs::{file_name, JobKind, Outcome, RunningJob, Then}; -use super::{AppState, DocPayload}; +use crate::state::jobs::{file_name, JobKind, Outcome, RunningJob, Then}; +use crate::state::{AppState, DocPayload}; /// How an effects read ended. #[derive(Debug, Clone, PartialEq, Eq)] @@ -30,7 +30,7 @@ pub struct EffectsRead { impl EffectsRead { /// Read the container `find` of `archive`, at most `limit` bytes, on a worker. - pub(super) fn start(archive: &Path, find: Rpf9ScanFind, limit: u64) -> Self { + pub(in crate::state) fn start(archive: &Path, find: Rpf9ScanFind, limit: u64) -> Self { let doing = tr!( "Reading the effects at {offset} of {archive}", offset = format!("{:#X}", find.offset), @@ -43,7 +43,7 @@ impl EffectsRead { } /// Read every `SGD5` container a scan of `archive` finds, at most `limit` bytes each, on a worker. - pub(super) fn every_container(archive: &Path, limit: u64) -> Self { + pub(in crate::state) fn every_container(archive: &Path, limit: u64) -> Self { let doing = tr!( "Reading the effects of {archive}", archive = file_name(archive) @@ -86,7 +86,7 @@ impl EffectsRead { } /// The read while it runs, as the job list draws it. - pub(super) fn job(&self) -> Option { + pub(in crate::state) fn job(&self) -> Option { if self.ended().is_some() { return None; } @@ -99,11 +99,11 @@ impl EffectsRead { }) } - pub(super) fn stop(&self) { + pub(in crate::state) fn stop(&self) { self.cancel.set(); } - pub(super) fn ended(&self) -> Option { + pub(in crate::state) fn ended(&self) -> Option { self.ended.lock().unwrap_or_else(|p| p.into_inner()).clone() } } @@ -137,8 +137,8 @@ fn effects( } let platform = or_io::container::rpf::rpf9_platform_of(archive).unwrap_or(or_io::Platform::XboxSeries); - let count = super::gta6_resource::learn_effects(&bytes, platform)?; - super::gta6_shaders::add_source(archive, find.offset, &bytes, platform); + let count = crate::state::gta6_resource::learn_effects(&bytes, platform)?; + crate::state::gta6_shaders::add_source(archive, find.offset, &bytes, platform); Ok(count) } @@ -164,8 +164,8 @@ fn every_container( if matches!(find.kind, Rpf9BodyKind::Sgd5 { .. }) { let (_, bytes) = read_rpf9_body(&file, find.offset, limit).map_err(|e| e.to_string())?; - learned += super::gta6_resource::learn_effects(&bytes, platform)?; - super::gta6_shaders::add_source(archive, find.offset, &bytes, platform); + learned += crate::state::gta6_resource::learn_effects(&bytes, platform)?; + crate::state::gta6_shaders::add_source(archive, find.offset, &bytes, platform); } } Ok(learned) @@ -182,12 +182,12 @@ fn install_read( } /// The install folder's effects read while it runs, as the job list draws it. -pub(super) fn install_job() -> Option { +pub(in crate::state) fn install_job() -> Option { install_read().as_ref()?.1.as_ref()?.job() } /// Ask the install folder's effects read to stop. -pub(super) fn stop_install_read() { +pub(in crate::state) fn stop_install_read() { if let Some((_, Some(read))) = install_read().as_ref() { read.stop(); } @@ -226,10 +226,10 @@ impl AppState { /// Start reading the effects of the GTA VI install folder's `shaders.rpf` once for each folder /// set, unless the app already knows effects. fn start_install_effects(&self) { - let Some((_, root)) = super::gta_vi::install(&self.prefs) else { + let Some((_, root)) = crate::state::gta_vi::install(&self.prefs) else { return; }; - if !super::gta6_resource::kept_effects_ready() { + if !crate::state::gta6_resource::kept_effects_ready() { return; } let mut read = install_read(); @@ -237,13 +237,13 @@ impl AppState { return; } let archive = root.join("shaders.rpf"); - let start = !super::gta6_resource::effects_known() && archive.is_file(); + let start = !crate::state::gta6_resource::effects_known() && archive.is_file(); let started = start.then(|| EffectsRead::every_container(&archive, 1 << 30)); *read = Some((root.clone(), started)); } /// Say in the job list how each effects read that ended went. - pub(super) fn poll_effects_reads(&mut self) { + pub(in crate::state) fn poll_effects_reads(&mut self) { self.start_install_effects(); let mut ended: Vec = (self.documents.iter()) .filter_map(|doc| match &doc.payload { @@ -253,7 +253,7 @@ impl AppState { .collect(); // ⚠ Only by the state whose folder it was started for: another state of the process would // say the end in its own job list, and the one that asked would wait for it for ever. - let root = super::gta_vi::install(&self.prefs).map(|(_, root)| root); + let root = crate::state::gta_vi::install(&self.prefs).map(|(_, root)| root); if let Some((_, read)) = (install_read().as_mut()).filter(|(of, _)| root == Some(of)) { if let Some(end) = read.as_ref().and_then(EffectsRead::ended) { ended.push(end); @@ -281,6 +281,6 @@ impl AppState { }; self.jobs.record(JobKind::EffectsRead, outcome, said); } - super::gta6_shaders::poll(&mut self.jobs); + crate::state::gta6_shaders::poll(&mut self.jobs); } } diff --git a/src/state/gta6_export.rs b/src/state/gta6/drawable/gta6_export.rs similarity index 76% rename from src/state/gta6_export.rs rename to src/state/gta6/drawable/gta6_export.rs index 7edd72b87..d9b9602f2 100644 --- a/src/state/gta6_export.rs +++ b/src/state/gta6/drawable/gta6_export.rs @@ -6,16 +6,16 @@ use std::sync::Arc; use or_interchange::Scene; use or_io::gta6::headerless::{Resource, Skeleton}; -use super::gta6_resource::{drawable_of, effect_name, texture_name}; -use super::textures::Texture; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::gta6_resource::{drawable_of, effect_name, texture_name}; +use crate::state::textures::Texture; +use crate::state::{AppState, DocPayload, DocumentId}; /// What a GTA VI drawable's export reads, gathered when it is asked for. #[derive(Clone)] -pub(super) struct Gta6Export { +pub(in crate::state) struct Gta6Export { body: Arc, /// The selection that picks a dictionary's drawable. - chosen: Option, + chosen: Option, skeleton: Option, /// Each texture a key of the drawable resolves to, by the name the key is known by. textures: Vec<(String, Texture<'static>)>, @@ -23,7 +23,7 @@ pub(super) struct Gta6Export { impl Gta6Export { /// The export of `doc`, a scanned GTA VI body; `None` for any other document. - pub(super) fn of(state: &AppState, doc: DocumentId) -> Option { + pub(in crate::state) fn of(state: &AppState, doc: DocumentId) -> Option { let document = state.document(doc)?; let DocPayload::Gta6Drawable(body) = &document.payload else { return None; @@ -32,12 +32,12 @@ impl Gta6Export { let path = document.path.as_deref(); let skeleton = match &**body { Resource::Drawable(_) | Resource::DrawableWithBound(_) => { - super::rpf9_scan::scanned_skeleton(path?).ok() + crate::state::rpf9_scan::scanned_skeleton(path?).ok() } // A dictionary's entry is skinned to the skeleton it holds itself, where it holds one. Resource::Dictionary(_) => { - let code = chosen.and_then(super::SelectionKey::dict_hash); - code.and_then(|code| super::gta6_entry_skeletons::of(path?, code)) + let code = chosen.and_then(crate::state::SelectionKey::dict_hash); + code.and_then(|code| crate::state::gta6_entry_skeletons::of(path?, code)) } _ => None, }; @@ -52,7 +52,7 @@ impl Gta6Export { if textures.iter().any(|(n, _)| *n == name) { continue; } - let found = super::texture_resolution::resolve(state, None, chosen, &name); + let found = crate::state::texture_resolution::resolve(state, None, chosen, &name); if let Some(found) = found { textures.push((name, found.texture.into_owned())); } @@ -67,7 +67,7 @@ impl Gta6Export { } /// The scene of the drawable chosen, named `stem`; `None` where none is chosen. - pub(super) fn scene(&self, stem: &str, every_lod: bool) -> Option { + pub(in crate::state) fn scene(&self, stem: &str, every_lod: bool) -> Option { let drawable = drawable_of(&self.body, self.chosen)?; let names = or_cli::Gta6Names { effect: &effect_name, diff --git a/src/state/gta6_fragment.rs b/src/state/gta6/drawable/gta6_fragment.rs similarity index 94% rename from src/state/gta6_fragment.rs rename to src/state/gta6/drawable/gta6_fragment.rs index b03ca14f5..5ff8be545 100644 --- a/src/state/gta6_fragment.rs +++ b/src/state/gta6/drawable/gta6_fragment.rs @@ -4,7 +4,7 @@ use or_io::gta6::headerless::{Cloth, ClothKind, Fragment, HeaderlessError, Surface}; /// A fragment's groups and children, its bounds listed by bone and the records it only counts. -pub(super) fn fragment_lines(f: &Fragment, lines: &mut Vec) { +pub(in crate::state) fn fragment_lines(f: &Fragment, lines: &mut Vec) { let Some(archetype) = f.archetype else { lines.push( tr!("It has no physics level: its archetype, groups and children are null.") @@ -27,7 +27,7 @@ pub(super) fn fragment_lines(f: &Fragment, lines: &mut Vec) { f.bone_bounds.len() )); } - super::gta6_fragment_records::record_lines(f, lines); + crate::state::gta6_fragment_records::record_lines(f, lines); // Of the root's records, only the vehicle record at 0xE8 is read for its counts alone. let slots: Vec = (f.records.iter()) .filter(|(slot, _)| *slot == 0xE8) @@ -42,7 +42,7 @@ pub(super) fn fragment_lines(f: &Fragment, lines: &mut Vec) { } /// What a drawable's record at 0xD0 holds, or why it is not read. -pub(super) fn surfaces_line(surfaces: &Result, HeaderlessError>) -> String { +pub(in crate::state) fn surfaces_line(surfaces: &Result, HeaderlessError>) -> String { match surfaces { Ok(s) => tr!( "The record at 0xD0 holds {surfaces} surfaces of {triangles} triangles in the drawable's frame, drawn over the model: they are no level of detail's geometry.", @@ -54,7 +54,7 @@ pub(super) fn surfaces_line(surfaces: &Result, HeaderlessError>) -> } /// A cloth record's head, then its type's counts and tables. -pub(super) fn cloth_lines(c: &Cloth, lines: &mut Vec) { +pub(in crate::state) fn cloth_lines(c: &Cloth, lines: &mut Vec) { let kind = match c.kind { ClothKind::Elements { .. } => 1, ClothKind::Edges { .. } => 2, diff --git a/src/state/gta6_fragment_records.rs b/src/state/gta6/drawable/gta6_fragment_records.rs similarity index 97% rename from src/state/gta6_fragment_records.rs rename to src/state/gta6/drawable/gta6_fragment_records.rs index 74eb582cb..61a0a3820 100644 --- a/src/state/gta6_fragment_records.rs +++ b/src/state/gta6/drawable/gta6_fragment_records.rs @@ -4,7 +4,7 @@ use or_io::gta6::headerless::Fragment; /// A line for each record of `f` that was read or refused, and one for its wheels. -pub(super) fn record_lines(f: &Fragment, lines: &mut Vec) { +pub(in crate::state) fn record_lines(f: &Fragment, lines: &mut Vec) { if let Some(glass) = &f.vehicle_glass { lines.push(match glass { Ok(g) => tr_n!( diff --git a/src/state/gta6_gltf_import.rs b/src/state/gta6/drawable/gta6_gltf_import/mod.rs similarity index 92% rename from src/state/gta6_gltf_import.rs rename to src/state/gta6/drawable/gta6_gltf_import/mod.rs index e0949e9be..f40905fad 100644 --- a/src/state/gta6_gltf_import.rs +++ b/src/state/gta6/drawable/gta6_gltf_import/mod.rs @@ -13,11 +13,11 @@ use or_io::gta6::headerless::{ read_dictionary, read_drawable, read_drawable_with_bound, Drawable, Entry, Model, Resource, }; -use super::document::Document; -use super::edit_history::{Change, Swap}; -use super::gta6_edit::EditSections; -use super::gta6_resource_save::EditedSave; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::document::Document; +use crate::state::edit_history::{Change, Swap}; +use crate::state::gta6_edit::EditSections; +use crate::state::gta6_resource_save::EditedSave; +use crate::state::{AppState, DocPayload, DocumentId}; /// The most bytes an import reads of a body again. const BODY_LIMIT: u64 = 1 << 30; @@ -31,11 +31,11 @@ type ReadScene = (Arc, Choice); /// What an import is asked, as `model replace` takes `--fill-missing` and `--lods replaced`. #[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] -pub(super) struct Choice { +pub(in crate::state) struct Choice { /// A channel the mesh omits at another vertex count takes its stated default. - pub(super) fill: bool, + pub(in crate::state) fill: bool, /// A lower level the mesh names none of takes its level-0 mesh where the shader matches. - pub(super) lower_lods: bool, + pub(in crate::state) lower_lods: bool, } /// The imports made to each scanned body, by its document's path, oldest first. @@ -47,7 +47,7 @@ fn imports() -> MutexGuard<'static, BTreeMap>> { } /// Forget the imports of the body at `path`, which opens anew with none. -pub(super) fn forget(path: &Path) { +pub(in crate::state) fn forget(path: &Path) { imports().remove(path); } @@ -65,17 +65,17 @@ pub(crate) struct Gta6Import { impl Gta6Import { /// The import into the drawable `doc` shows; `None` for any document but a scanned GTA VI body. - pub(super) fn of(state: &AppState, doc: DocumentId) -> Option> { + pub(in crate::state) fn of(state: &AppState, doc: DocumentId) -> Option> { let document = state.document(doc)?; let DocPayload::Gta6Drawable(resource) = &document.payload else { return None; }; let selection = state.selection.selected(doc); - let Some(code) = super::gta6_edit::drawable_code(resource, selection) else { + let Some(code) = crate::state::gta6_edit::drawable_code(resource, selection) else { return Some(Err(only_a_drawable())); }; let path = document.path.as_deref(); - let Some((archive, offset)) = path.and_then(super::rpf9_scan::scanned_body) else { + let Some((archive, offset)) = path.and_then(crate::state::rpf9_scan::scanned_body) else { let why = tr!( "This body has no file to be read again from, so no glTF replaces its geometry." ); @@ -95,7 +95,7 @@ impl Gta6Import { /// The body with the document's earlier imports and the glTF at `mesh` made to it, read back /// as the resource the document shows, and what each geometry took, as the report says it; /// `None` once `cancel` stops it between two replacements. - pub(super) fn imported( + pub(in crate::state) fn imported( &self, mesh: &Path, choice: Choice, @@ -111,7 +111,7 @@ impl Gta6Import { choice: Choice, cancel: &or_job::Cancel, ) -> Result<(Box, ImportReport), String> { - let named = super::jobs::file_name(mesh); + let named = crate::state::jobs::file_name(mesh); let source = std::fs::read(mesh) .map_err(|e| tr!("{mesh} did not read: {e}", e = e, mesh = named))?; let scene = or_interchange::gltf::read::load(mesh, &source).map_err(|e| { @@ -241,7 +241,7 @@ impl Swap for Imports { impl AppState { /// The answered import's geometry into `doc`, from `payload`, the body as it read back: its /// levels and box in place of the drawable's, as one step of undo, the rest of it as edited. - pub(super) fn apply_gta6_import( + pub(in crate::state) fn apply_gta6_import( &mut self, doc: DocumentId, mesh: &Path, @@ -291,7 +291,7 @@ impl AppState { if let Change::Part { parts, .. } = &mut change { parts.push(Box::new(Imports { path, other })); } - let name = super::jobs::file_name(mesh); + let name = crate::state::jobs::file_name(mesh); self.record(doc, tr!("Replace from {mesh}", mesh = name), change); // An import is a step of its own, never folded into the next. if let Some(document) = self.document_mut(doc) { @@ -306,8 +306,8 @@ impl AppState { /// The GTA VI drawable row's `edited_sections`: every other edit of the document, then each glTF /// import it holds made again over the body, oldest first. -pub(super) fn edited_save(document: &Document) -> Option> { - let save = super::gta6_embedded_edit::edited_save(document)?; +pub(in crate::state) fn edited_save(document: &Document) -> Option> { + let save = crate::state::gta6_embedded_edit::edited_save(document)?; let held = (document.path.as_deref()).and_then(|p| imports().get(p).cloned()); let Some(held) = held.filter(|h| !h.is_empty()) else { return Some(save); @@ -338,5 +338,4 @@ pub(super) fn edited_save(document: &Document) -> Option>; @@ -37,7 +37,7 @@ fn heads() -> MutexGuard<'static, Vec> { /// Read the head of the drawable, or of the fragment's drawable where `fragment`, that the scanned /// body at `path` holds, and keep it for `resource`, the body read. -pub(super) fn keep( +pub(in crate::state) fn keep( path: &Path, resource: &Arc, virtual_section: &[u8], @@ -66,7 +66,7 @@ fn hold(path: &Path, resource: &Arc, head: Result Option { /// The texture `name` that the drawable `selection` shows binds by the key of a texture its own /// shader group embeds. -pub(super) fn texture_named<'p>( +pub(in crate::state) fn texture_named<'p>( payload: &'p DocPayload, selection: Option, name: &str, @@ -110,8 +110,8 @@ pub(super) fn texture_named<'p>( .filter_map(|k| Some((&k.path, (*k.head).as_ref().ok()?))) .find(|(_, head)| head.name == drawable.name)?; // What the document holds, a texture in any shape or none, is drawn in place of the body's. - use super::gta6_embedded_edit::Held; - let pixels = match super::gta6_embedded_edit::edited(path, key) { + use crate::state::gta6_embedded_edit::Held; + let pixels = match crate::state::gta6_embedded_edit::edited(path, key) { Some(Held::Texture(texture)) => texture, Some(Held::Removed) => return None, None => { @@ -135,7 +135,7 @@ pub(super) fn texture_named<'p>( } } }; - let texture = super::ttpf_document::grc(name.to_string(), pixels).ok()?; + let texture = crate::state::ttpf_document::grc(name.to_string(), pixels).ok()?; Some(Texture::Owned(Cow::Owned(texture))) } diff --git a/src/state/gta6_material_declared.rs b/src/state/gta6/drawable/gta6_material_declared/mod.rs similarity index 99% rename from src/state/gta6_material_declared.rs rename to src/state/gta6/drawable/gta6_material_declared/mod.rs index d23595bee..4b5c5a1af 100644 --- a/src/state/gta6_material_declared.rs +++ b/src/state/gta6/drawable/gta6_material_declared/mod.rs @@ -183,5 +183,4 @@ pub(crate) fn declared_shader(shader: &Shader, effect: &ShaderDef) -> Result) { +pub(in crate::state) fn morph_lines(m: &MorphTarget, lines: &mut Vec) { lines.push(tr!( "A morph target of {elements} deltas for the mesh hash_{key}. Which axis each of its three lanes holds is not known, so no delta is given as a vector.", elements = m.elements.len(), diff --git a/src/state/gta6_selected.rs b/src/state/gta6/drawable/gta6_selected.rs similarity index 93% rename from src/state/gta6_selected.rs rename to src/state/gta6/drawable/gta6_selected.rs index de62e31a4..1c172fe58 100644 --- a/src/state/gta6_selected.rs +++ b/src/state/gta6/drawable/gta6_selected.rs @@ -4,9 +4,9 @@ use glam::{Mat4, Vec4}; use or_io::gta6::headerless::{Drawable, Geometry, Model, Palette, Skeleton}; -use super::gta6_resource::drawable_of; -use super::selection::{DictPart, SelectionKey}; -use super::{DocPayload, Document}; +use crate::state::gta6_resource::drawable_of; +use crate::state::selection::{DictPart, SelectionKey}; +use crate::state::{DocPayload, Document}; /// A heading, and the rows of the grid under it. pub(crate) type Rows = (String, Vec<(String, String)>); @@ -38,7 +38,7 @@ pub(crate) fn bone_of(selection: SelectionKey) -> Option { /// What the status bar says of the part `selection` names in the drawable named `name`. pub(crate) fn summary(name: &str, selection: SelectionKey) -> Option { - let entry_bone = super::gta6_entry_skeletons::entry_bone_of(selection).map(|(_, b)| b); + let entry_bone = crate::state::gta6_entry_skeletons::entry_bone_of(selection).map(|(_, b)| b); if let Some(bone) = bone_of(selection).or(entry_bone) { return Some(tr!("{name}: bone {bone}", name = name, bone = bone)); } @@ -66,11 +66,11 @@ pub(crate) fn selected_rows(doc: &Document, selection: SelectionKey) -> Option [f32; 3] { w: q.w, ..Default::default() }; - super::bone_numbers::euler_degrees(&held) + crate::state::bone_numbers::euler_degrees(&held) } diff --git a/src/state/gta6_forward_passes.rs b/src/state/gta6/drawable/gta6_shaders/forward_passes.rs similarity index 100% rename from src/state/gta6_forward_passes.rs rename to src/state/gta6/drawable/gta6_shaders/forward_passes.rs diff --git a/src/state/gta6_global_textures.rs b/src/state/gta6/drawable/gta6_shaders/global_textures.rs similarity index 100% rename from src/state/gta6_global_textures.rs rename to src/state/gta6/drawable/gta6_shaders/global_textures.rs diff --git a/src/state/gta6_layer_index.rs b/src/state/gta6/drawable/gta6_shaders/layer_index.rs similarity index 100% rename from src/state/gta6_layer_index.rs rename to src/state/gta6/drawable/gta6_shaders/layer_index.rs diff --git a/src/state/gta6_shaders.rs b/src/state/gta6/drawable/gta6_shaders/mod.rs similarity index 98% rename from src/state/gta6_shaders.rs rename to src/state/gta6/drawable/gta6_shaders/mod.rs index 32188a291..ecb8938ef 100644 --- a/src/state/gta6_shaders.rs +++ b/src/state/gta6/drawable/gta6_shaders/mod.rs @@ -25,7 +25,7 @@ use or_io::gta6::hash::name_hash32; use or_job::{Cancel, Progress}; use or_renderer::game_shaders::pack::GamePack; -use super::jobs::{JobKind, JobLog, Outcome as Ended, RunningJob, Then}; +use crate::state::jobs::{JobKind, JobLog, Outcome as Ended, RunningJob, Then}; /// The bytes one effect container is read to while an install's archive is searched for them. const CONTAINER_LIMIT: u64 = 1 << 30; @@ -168,7 +168,12 @@ fn stopped() -> String { /// Keep the `SGD5` container `bytes`, read at `base` of `archive`, as a place programs are read from. // ponytail: opens the container a second time beside the effects read; one open when it shows. -pub(super) fn add_source(archive: &Path, base: u64, bytes: &[u8], platform: or_io::Platform) { +pub(in crate::state) fn add_source( + archive: &Path, + base: u64, + bytes: &[u8], + platform: or_io::Platform, +) { let Ok(file) = Sgd5File::open(bytes, platform) else { return; }; @@ -294,14 +299,14 @@ impl Running { /// The folder a session keeps what it read and translated of GTA VI's programs in, for the next. fn kept_folder() -> Option { - Some(super::prefs::config_root()?.join("gta6_shaders")) + Some(crate::state::prefs::config_root()?.join("gta6_shaders")) } /// The file the effect whose name hashes to `hash` is kept in as `archive` holds it now: by the /// archive's path, its size and when it was last written. fn kept_effect(archive: &Path, hash: u32) -> Option { use std::hash::{Hash, Hasher}; - let stat = super::gta6_texture_index::stat(archive)?; + let stat = crate::state::gta6_texture_index::stat(archive)?; let mut hasher = std::collections::hash_map::DefaultHasher::new(); (archive, stat).hash(&mut hasher); let folder = format!("{:016x}", hasher.finish()); @@ -831,7 +836,7 @@ fn search( /// Take what a job that ended found into the session's translations, build their pack, and say /// in the job list how it went. -pub(super) fn poll(jobs: &mut JobLog) { +pub(in crate::state) fn poll(jobs: &mut JobLog) { let said = with(|s| { let result = (s.running.as_ref()?.ended.lock()) .unwrap_or_else(|p| p.into_inner()) @@ -1009,7 +1014,7 @@ fn status_of(s: &Shaders, hashes: &[u32]) -> Status { } /// The translation while it runs, as the job list draws it. -pub(super) fn job() -> Option { +pub(in crate::state) fn job() -> Option { with(|s| { let running = s.running.as_ref()?; let ended = (running.ended.lock()) @@ -1026,7 +1031,7 @@ pub(super) fn job() -> Option { } /// Ask the translation to stop; its end is said by [`poll`]. -pub(super) fn stop() { +pub(in crate::state) fn stop() { with(|s| { if let Some(running) = &s.running { running.cancel.set(); @@ -1034,14 +1039,16 @@ pub(super) fn stop() { }); } -impl super::AppState { +impl crate::state::AppState { /// What the editor does once its graphics device is lost while the view draws in `mode`: the /// view goes back to Material, what a GTA VI drawable's own passes were drawing is kept from /// the next device, and a person is told. pub(crate) fn graphics_device_lost(&mut self, mode: or_renderer::ShadingMode) { use or_renderer::ShadingMode; let own = self.active_document().map(|doc| &doc.payload); - if mode == ShadingMode::Shaded && matches!(own, Some(super::DocPayload::Gta6Drawable(_))) { + if mode == ShadingMode::Shaded + && matches!(own, Some(crate::state::DocPayload::Gta6Drawable(_))) + { crate::render::gta6_meshlets::device_lost(); } self.remember_shading_mode(ShadingMode::Material); @@ -1052,30 +1059,22 @@ impl super::AppState { } /// The catalogues and asset lists of an install, which join a ped's drawable to its textures. -#[path = "gta6_ped_assets.rs"] pub(crate) mod ped_assets; /// The textures of an install's texture archive the game binds by name whatever is drawn. -#[path = "gta6_global_textures.rs"] pub(crate) mod global_textures; /// The terrain tile an open terrain drawable is a cell of: its record, layers and cells. -#[path = "gta6_terrain_tile.rs"] pub(crate) mod terrain_tile; -#[path = "gta6_layer_index.rs"] pub(crate) mod layer_index; -#[path = "gta6_shader_translator.rs"] mod translator; use translator::{share, Stages, Translate, Translator, Workers}; -#[path = "gta6_forward_passes.rs"] mod forward_passes; -#[path = "gta6_timecycle.rs"] pub(crate) mod timecycle; #[cfg(test)] -#[path = "gta6_shaders_tests.rs"] mod tests; diff --git a/src/state/gta6_ped_assets.rs b/src/state/gta6/drawable/gta6_shaders/ped_assets/mod.rs similarity index 99% rename from src/state/gta6_ped_assets.rs rename to src/state/gta6/drawable/gta6_shaders/ped_assets/mod.rs index b90d5b9f9..b5fdb6ae8 100644 --- a/src/state/gta6_ped_assets.rs +++ b/src/state/gta6/drawable/gta6_shaders/ped_assets/mod.rs @@ -392,5 +392,4 @@ mod tests { } /// The skin tones of an install, read apart from this index. -#[path = "gta6_skin_tones.rs"] pub(crate) mod skin_tones; diff --git a/src/state/gta6_skin_tones.rs b/src/state/gta6/drawable/gta6_shaders/ped_assets/skin_tones.rs similarity index 100% rename from src/state/gta6_skin_tones.rs rename to src/state/gta6/drawable/gta6_shaders/ped_assets/skin_tones.rs diff --git a/src/state/gta6_terrain_tile.rs b/src/state/gta6/drawable/gta6_shaders/terrain_tile.rs similarity index 100% rename from src/state/gta6_terrain_tile.rs rename to src/state/gta6/drawable/gta6_shaders/terrain_tile.rs diff --git a/src/state/gta6_shaders_tests.rs b/src/state/gta6/drawable/gta6_shaders/tests.rs similarity index 100% rename from src/state/gta6_shaders_tests.rs rename to src/state/gta6/drawable/gta6_shaders/tests.rs diff --git a/src/state/gta6_timecycle.rs b/src/state/gta6/drawable/gta6_shaders/timecycle.rs similarity index 100% rename from src/state/gta6_timecycle.rs rename to src/state/gta6/drawable/gta6_shaders/timecycle.rs diff --git a/src/state/gta6_shader_translator.rs b/src/state/gta6/drawable/gta6_shaders/translator.rs similarity index 100% rename from src/state/gta6_shader_translator.rs rename to src/state/gta6/drawable/gta6_shaders/translator.rs diff --git a/src/state/gta6_summaries.rs b/src/state/gta6/drawable/gta6_summaries.rs similarity index 82% rename from src/state/gta6_summaries.rs rename to src/state/gta6/drawable/gta6_summaries.rs index 8b0fb6826..7a9fa517e 100644 --- a/src/state/gta6_summaries.rs +++ b/src/state/gta6/drawable/gta6_summaries.rs @@ -1,16 +1,16 @@ //! What the status bar says of the part selected in a scanned GTA VI drawable or animation. -use super::selection::SelectionKey; -use super::DocPayload; +use crate::state::selection::SelectionKey; +use crate::state::DocPayload; /// The drawable, dictionary entry or bound selected. -pub(super) fn gta6_drawable_summary(payload: &DocPayload, sel: SelectionKey) -> String { +pub(in crate::state) fn gta6_drawable_summary(payload: &DocPayload, sel: SelectionKey) -> String { use or_io::gta6::headerless::Resource; let DocPayload::Gta6Drawable(resource) = payload else { return String::new(); }; - let chosen = super::gta6_resource::drawable_of(resource, Some(sel)); - if let Some(said) = chosen.and_then(|d| super::gta6_selected::summary(&d.name, sel)) { + let chosen = crate::state::gta6_resource::drawable_of(resource, Some(sel)); + if let Some(said) = chosen.and_then(|d| crate::state::gta6_selected::summary(&d.name, sel)) { return said; } if let Some(said) = crate::ui::panels::hierarchy::gta6_filters::summary(resource, sel) { @@ -30,7 +30,7 @@ pub(super) fn gta6_drawable_summary(payload: &DocPayload, sel: SelectionKey) -> } (Resource::Dictionary(_), None) => format!( "{} drawables", - super::gta6_resource::dictionary_drawables(resource).count() + crate::state::gta6_resource::dictionary_drawables(resource).count() ), (Resource::Bound(_), _) => tr!("Bound selected").to_string(), (_, Some(d)) => tr!("Drawable: {name}", name = d.name), @@ -39,7 +39,7 @@ pub(super) fn gta6_drawable_summary(payload: &DocPayload, sel: SelectionKey) -> } /// The clip or animation selected, else how many the resource holds. -pub(super) fn gta6_anim_summary(payload: &DocPayload, sel: SelectionKey) -> String { +pub(in crate::state) fn gta6_anim_summary(payload: &DocPayload, sel: SelectionKey) -> String { use crate::state::gta6_anim_play::{ choice_count as gta6_choice_count, choice_label as gta6_choice_label, }; diff --git a/src/state/gta6_weapon_parts.rs b/src/state/gta6/drawable/gta6_weapon_parts.rs similarity index 96% rename from src/state/gta6_weapon_parts.rs rename to src/state/gta6/drawable/gta6_weapon_parts.rs index c76636e2b..8c8b23d82 100644 --- a/src/state/gta6_weapon_parts.rs +++ b/src/state/gta6/drawable/gta6_weapon_parts.rs @@ -51,13 +51,13 @@ pub(crate) fn of(path: &Path) -> Option>> { /// Read and keep the parts of `read`, the body at `path` of `archive`, where its skeleton offers a /// point and the archive's names are kept; a body opened again keeps what this read finds. -pub(super) fn keep(path: &Path, archive: &Path, read: &Resource) { - let parts = super::rpf9_scan::scanned_skeleton(path) +pub(in crate::state) fn keep(path: &Path, archive: &Path, read: &Resource) { + let parts = crate::state::rpf9_scan::scanned_skeleton(path) .ok() - .zip(super::gta6_resource::drawable_of(read, None)) + .zip(crate::state::gta6_resource::drawable_of(read, None)) .filter(|(skeleton, _)| !points(skeleton, Mat4::IDENTITY).is_empty()) .map(|(skeleton, drawable)| { - let labels = super::gta6_names::labels(archive); + let labels = crate::state::gta6_names::labels(archive); let Ok(file) = File::open(archive) else { return Vec::new(); }; diff --git a/src/state/gta6/drawable/mod.rs b/src/state/gta6/drawable/mod.rs new file mode 100644 index 000000000..dec2f2eb5 --- /dev/null +++ b/src/state/gta6/drawable/mod.rs @@ -0,0 +1,16 @@ +pub(crate) mod gta6_constant_types; +pub(crate) mod gta6_edit; +pub(crate) mod gta6_effect_facts; +pub(crate) mod gta6_effects; +pub(crate) mod gta6_export; +pub(crate) mod gta6_fragment; +pub(crate) mod gta6_fragment_records; +pub(crate) mod gta6_gltf_import; +pub(crate) mod gta6_head; +pub(crate) mod gta6_material_declared; +pub(crate) mod gta6_material_layout; +pub(crate) mod gta6_morph; +pub(crate) mod gta6_selected; +pub(crate) mod gta6_shaders; +pub(crate) mod gta6_summaries; +pub(crate) mod gta6_weapon_parts; diff --git a/src/state/gta6_first_entry.rs b/src/state/gta6/install/gta6_first_entry.rs similarity index 96% rename from src/state/gta6_first_entry.rs rename to src/state/gta6/install/gta6_first_entry.rs index 61de0875f..af9f91b09 100644 --- a/src/state/gta6_first_entry.rs +++ b/src/state/gta6/install/gta6_first_entry.rs @@ -13,8 +13,8 @@ use std::sync::{Mutex, MutexGuard}; use or_io::container::rpf::{rpf9_first_entry_end, Rpf9BodyKind, Rpf9ScanError, Rpf9ScanFind}; use or_job::{Cancel, Step}; -use super::document::HexDocument; -use super::rpf9_scan::{Ended, Found, Row}; +use crate::state::document::HexDocument; +use crate::state::rpf9_scan::{Ended, Found, Row}; /// Where each first entry whose end is not stated, and each nested archive, ends, by archive and /// offset, as its list gave it. @@ -26,12 +26,12 @@ fn given() -> MutexGuard<'static, BTreeMap<(PathBuf, u64), u64>> { } /// Whether `find` is a first entry whose length the scan stated, so a read gives it an end. -pub(super) fn ends(find: &Rpf9ScanFind) -> bool { +pub(in crate::state) fn ends(find: &Rpf9ScanFind) -> bool { matches!(find.kind, Rpf9BodyKind::FirstEntry { .. }) && find.stored_len.is_some() } /// Why no view reads a first entry whose end is stated. -pub(super) fn banner(find: &Rpf9ScanFind) -> String { +pub(in crate::state) fn banner(find: &Rpf9ScanFind) -> String { tr!( "The first entry after an archive's table, where its header puts it: the {count} bytes an archive of one entry that would otherwise be empty holds alone. No view reads them, so they show as bytes.", count = find.stored_len.unwrap_or(0), @@ -42,7 +42,7 @@ pub(super) fn banner(find: &Rpf9ScanFind) -> String { /// end is not stated ends where the list's next row starts, or at the file's end where a whole /// scan of the file lists none after it, and a nested archive where its names row ends. `false` /// where no row gives it one. -pub(super) fn note(archive: &Path, found: &Found, find: &Rpf9ScanFind) -> bool { +pub(in crate::state) fn note(archive: &Path, found: &Found, find: &Rpf9ScanFind) -> bool { let rows = &found.rows; let end = match find.kind { Rpf9BodyKind::FirstEntry { .. } if !ends(find) => { @@ -75,7 +75,7 @@ pub(super) fn note(archive: &Path, found: &Found, find: &Rpf9ScanFind) -> bool { } /// The end [`note`] gave the body at `offset` of `archive`, if it gave one. -pub(super) fn noted_end(archive: &Path, offset: u64) -> Option { +pub(in crate::state) fn noted_end(archive: &Path, offset: u64) -> Option { given().get(&(archive.to_path_buf(), offset)).copied() } @@ -84,7 +84,7 @@ const SLICE: usize = 8 << 20; /// The body at `offset` of `archive` copied to `target` as `rel_path` to the end [`note`] gave /// it; `None` where it gave none, and the body is read as any other. -pub(super) fn copied( +pub(in crate::state) fn copied( archive: &Path, offset: u64, target: &Path, @@ -156,7 +156,7 @@ fn copy(from: &mut impl Read, to: &Path, cancel: &Cancel) -> Result /// The bytes of the body at `offset` of `file`, the file at `archive`, that a read refused as /// `refused`, to the end [`note`] gave it, refused past `limit`; `None` where it gave none. -pub(super) fn bytes( +pub(in crate::state) fn bytes( archive: &Path, file: &File, offset: u64, @@ -189,7 +189,7 @@ pub(super) fn bytes( /// The first entry at `offset` of `archive` read to the end [`note`] gave it: the find it is /// opened as and its bytes under why no view reads them; `None` where it gave none. -pub(super) fn opened( +pub(in crate::state) fn opened( archive: &Path, file: &File, offset: u64, diff --git a/src/state/gta6_install_harvest.rs b/src/state/gta6/install/gta6_install_harvest.rs similarity index 91% rename from src/state/gta6_install_harvest.rs rename to src/state/gta6/install/gta6_install_harvest.rs index d2d32a765..3bf6db508 100644 --- a/src/state/gta6_install_harvest.rs +++ b/src/state/gta6/install/gta6_install_harvest.rs @@ -17,13 +17,13 @@ use or_io::gta6::hash::name_hash64; use or_io::gta6::headerless::{Entry, Resource}; use or_io::gta6::texture_names::name_keys; -use super::gta6_dictionary_index::Built; -use super::gta6_install_scan::{lock, Hit, InstallFound}; -use super::gta6_texture_index::{put, stat, stated}; -use super::gta6_texture_naming::{NamingEnded, TextureNaming}; -use super::rpf9_kept::{word, RULES}; -use super::rpf9_scan::{body_path, Ended, RowKind, View}; -use super::AppState; +use crate::state::gta6_dictionary_index::Built; +use crate::state::gta6_install_scan::{lock, Hit, InstallFound}; +use crate::state::gta6_texture_index::{put, stat, stated}; +use crate::state::gta6_texture_naming::{NamingEnded, TextureNaming}; +use crate::state::rpf9_kept::{word, RULES}; +use crate::state::rpf9_scan::{body_path, Ended, RowKind, View}; +use crate::state::AppState; /// The version of what this file keeps: a change to it takes another. const VERSION: u64 = 3; @@ -34,8 +34,8 @@ const BODY_LIMIT: u64 = 1 << 30; /// The install's dictionaries as the harvest found them, and whether the kept harvest was read this session. #[derive(Default)] -pub(super) struct Harvest { - pub(super) built: Arc>>, +pub(in crate::state) struct Harvest { + pub(in crate::state) built: Arc>>, read: bool, } @@ -77,7 +77,7 @@ fn body(file: &File, offset: u64) -> Option { }; let (virtual_section, physical) = resource.sections(&bytes); let read = or_io::gta6::headerless::read(signature, virtual_section, Some(physical)).ok()?; - super::gta6_key_words::learn(signature, virtual_section, &read); + crate::state::gta6_key_words::learn(signature, virtual_section, &read); Some(read) } @@ -101,7 +101,7 @@ fn gathered( } } } - let stems = super::ttpf_document::stated_names(resource); + let stems = crate::state::ttpf_document::stated_names(resource); if stems.is_empty() { return held; } @@ -109,9 +109,9 @@ fn gathered( let keys = match keys.is_empty() { false => keys, true => { - let drawables = super::gta6_resource::dictionary_drawables(resource) + let drawables = crate::state::gta6_resource::dictionary_drawables(resource) .map(|(_, d)| d) - .chain(super::gta6_resource::drawable_of(resource, None)); + .chain(crate::state::gta6_resource::drawable_of(resource, None)); let bound_keys = drawables .flat_map(|d| &d.shaders) .flat_map(|s| &s.texture_keys); @@ -188,7 +188,7 @@ fn serve(kept: &HashMap, built: &Mutex>) -> us .map(|(_, harvested)| harvested) .collect(); let names = standing.iter().flat_map(|h| h.names.clone()); - let named = super::ttpf_document::learn_named(names); + let named = crate::state::ttpf_document::learn_named(names); let dictionaries = standing.iter().flat_map(|h| h.dictionaries.clone()); *built.lock().unwrap_or_else(|p| p.into_inner()) = Some(Built::of(dictionaries)); named @@ -197,7 +197,7 @@ fn serve(kept: &HashMap, built: &Mutex>) -> us /// Where the harvest is kept, one file for every install. // ponytail: an archive since moved or deleted stays in it, as an archive's kept scan does. fn kept_file() -> Option { - let root = super::prefs::config_root()?; + let root = crate::state::prefs::config_root()?; Some(root.join("gta6_harvest.kept")) } @@ -292,7 +292,7 @@ fn keep(file: &Path, kept: &HashMap) -> io::Result<()> { impl AppState { /// Serve the harvest kept in the configuration folder, read on a worker once a session. - pub(super) fn read_kept_harvest(&mut self) { + pub(in crate::state) fn read_kept_harvest(&mut self) { let harvest = &mut self.texture_packs.dictionaries.harvest; if std::mem::replace(&mut harvest.read, true) { return; @@ -302,14 +302,14 @@ impl AppState { }; let built = Arc::clone(&harvest.built); std::thread::spawn(move || { - super::gta6_key_words::read_kept(); + crate::state::gta6_key_words::read_kept(); serve(&read_kept(&file), &built) }); } /// Read, as a job, the dictionaries and drawables of each archive under `root` that the /// install scan `found` read whole, an archive the kept harvest holds as it is now excepted. - pub(super) fn harvest_install(&mut self, root: &Path, found: &Mutex) { + pub(in crate::state) fn harvest_install(&mut self, root: &Path, found: &Mutex) { let archives: Vec<(PathBuf, Vec)> = { let found = lock(found); (found.archives.iter()) @@ -326,7 +326,7 @@ impl AppState { let Some(file) = kept_file() else { return; }; - let packs = super::gta6_texture_index::pack_keys(root); + let packs = crate::state::gta6_texture_index::pack_keys(root); let built = Arc::clone(&self.texture_packs.dictionaries.harvest.built); let doing = tr!( "Reading the drawables and texture dictionaries of every GTA VI archive under {folder}", @@ -344,7 +344,7 @@ impl AppState { tracing::warn!(%error, "the harvest of the install's archives was not kept"); } if changed { - super::gta6_key_words::keep(); + crate::state::gta6_key_words::keep(); } let named = serve(&kept, &built); match stopped { diff --git a/src/state/gta6_install_scan.rs b/src/state/gta6/install/gta6_install_scan.rs similarity index 97% rename from src/state/gta6_install_scan.rs rename to src/state/gta6/install/gta6_install_scan.rs index 18680c15b..3261b7eeb 100644 --- a/src/state/gta6_install_scan.rs +++ b/src/state/gta6/install/gta6_install_scan.rs @@ -9,9 +9,11 @@ use std::time::Duration; use or_job::{Cancel, Progress}; -use super::jobs::{file_name, JobKind, Outcome, RunningJob, Then}; -use super::rpf9_scan::{body_path, opens_as_bytes, Ended, Row, RowKind, Rpf9ScanDocument, View}; -use super::AppState; +use crate::state::jobs::{file_name, JobKind, Outcome, RunningJob, Then}; +use crate::state::rpf9_scan::{ + body_path, opens_as_bytes, Ended, Row, RowKind, Rpf9ScanDocument, View, +}; +use crate::state::AppState; pub(crate) use or_title::install::gta6_files::{MOST_ARCHIVES, MOST_FOLDERS}; /// The most bodies the scan keeps. @@ -117,7 +119,7 @@ pub(crate) fn stopping() -> bool { } /// The scan while it runs, as the job list draws it. -pub(super) fn job() -> Option { +pub(in crate::state) fn job() -> Option { let held = install(); let scan = held.as_ref()?; let found = lock(&scan.found); @@ -144,7 +146,7 @@ pub(super) fn job() -> Option { impl AppState { /// Say in the job list how the scan of every archive ended, once, and harvest the archives of a scan that ended whole. - pub(super) fn poll_install_scan(&mut self) { + pub(in crate::state) fn poll_install_scan(&mut self) { self.read_kept_harvest(); let (told, harvest) = { let mut held = install(); @@ -278,8 +280,9 @@ fn tally_of(path: &Path, scan: &Rpf9ScanDocument, held: &mut usize) -> ArchiveTa } let view = match found.view(find) { Ok(view) => Some(view), - Err(_) => (opens_as_bytes(find) && super::gta6_first_entry::note(path, &found, find)) - .then_some(View::Bytes), + Err(_) => (opens_as_bytes(find) + && crate::state::gta6_first_entry::note(path, &found, find)) + .then_some(View::Bytes), }; hits.push(Hit { offset: find.offset, diff --git a/src/state/gta6_key_words.rs b/src/state/gta6/install/gta6_key_words.rs similarity index 94% rename from src/state/gta6_key_words.rs rename to src/state/gta6/install/gta6_key_words.rs index 088da6e3a..48621a811 100644 --- a/src/state/gta6_key_words.rs +++ b/src/state/gta6/install/gta6_key_words.rs @@ -43,7 +43,11 @@ pub(crate) fn typed(text: &str) { /// Keep each word the key records of the drawables of `resource` state, read from /// `virtual_section` under `signature`. -pub(super) fn learn(signature: Rpf9Signature, virtual_section: &[u8], resource: &Resource) { +pub(in crate::state) fn learn( + signature: Rpf9Signature, + virtual_section: &[u8], + resource: &Resource, +) { let Some(role) = signature.role() else { return; }; @@ -62,7 +66,7 @@ pub(super) fn learn(signature: Rpf9Signature, virtual_section: &[u8], resource: } fn kept_file() -> Option { - Some(super::prefs::config_root()?.join("gta6_key_words.kept")) + Some(crate::state::prefs::config_root()?.join("gta6_key_words.kept")) } fn encode(words: &BTreeMap) -> Vec { @@ -95,7 +99,7 @@ fn decode(sealed: &[u8]) -> io::Result> { } /// Keep every word learned in the configuration folder, with what was kept before. -pub(super) fn keep() { +pub(in crate::state) fn keep() { let Some(file) = kept_file() else { return; }; @@ -114,7 +118,7 @@ pub(super) fn keep() { } /// Learn the words kept in the configuration folder. -pub(super) fn read_kept() { +pub(in crate::state) fn read_kept() { let Some(file) = kept_file() else { return; }; diff --git a/src/state/gta6_learned_names.rs b/src/state/gta6/install/gta6_learned_names.rs similarity index 100% rename from src/state/gta6_learned_names.rs rename to src/state/gta6/install/gta6_learned_names.rs diff --git a/src/state/gta6_name_pool.rs b/src/state/gta6/install/gta6_name_pool.rs similarity index 68% rename from src/state/gta6_name_pool.rs rename to src/state/gta6/install/gta6_name_pool.rs index b510c1814..592ca8b24 100644 --- a/src/state/gta6_name_pool.rs +++ b/src/state/gta6/install/gta6_name_pool.rs @@ -5,13 +5,20 @@ use std::path::Path; use or_io::container::rpf::{Rpf9BodyKind, Rpf9Content, Rpf9ScanFind}; -use super::DocPayload; +use crate::state::DocPayload; /// The names of a zlib body no reader fits, where every byte is a name's or its NUL; `None` for any other body. -pub(super) fn payload(path: &Path, find: &Rpf9ScanFind, bytes: &[u8]) -> Option { +pub(in crate::state) fn payload( + path: &Path, + find: &Rpf9ScanFind, + bytes: &[u8], +) -> Option { if !matches!(find.kind, Rpf9BodyKind::Zlib(run) if run.content == Rpf9Content::Other) { return None; } let names = or_cli::gta6_name_pool(bytes)?; - Some(super::document_io::text_payload(path, names.into_bytes())) + Some(crate::state::document_io::text_payload( + path, + names.into_bytes(), + )) } diff --git a/src/state/gta6_names.rs b/src/state/gta6/install/gta6_names.rs similarity index 95% rename from src/state/gta6_names.rs rename to src/state/gta6/install/gta6_names.rs index 7b1646b52..06d0a5fd1 100644 --- a/src/state/gta6_names.rs +++ b/src/state/gta6/install/gta6_names.rs @@ -15,9 +15,9 @@ use or_io::gta6::names::{ use or_io::gta6::texture_names::{name_keys_by, parameter_name}; use or_job::{Cancel, Progress}; -use super::gta6_texture_naming::{NamingEnded, TextureNaming}; -use super::jobs::file_name; -use super::AppState; +use crate::state::gta6_texture_naming::{NamingEnded, TextureNaming}; +use crate::state::jobs::file_name; +use crate::state::AppState; static HELD: Mutex>> = Mutex::new(BTreeMap::new()); @@ -47,8 +47,8 @@ pub(crate) fn labels(archive: &Path) -> Arc { if let Some(labels) = held.get(archive) { return labels.clone(); } - let labels = - super::prefs::config_root().map_or_else(Labels::new, |root| load_labels(&root, archive)); + let labels = crate::state::prefs::config_root() + .map_or_else(Labels::new, |root| load_labels(&root, archive)); let labels = Arc::new(labels); held.insert(archive.to_path_buf(), labels.clone()); labels @@ -67,7 +67,7 @@ pub(crate) fn vocabulary() -> Arc { let mut slot = served(); let served = slot.get_or_insert_with(Served::default); if !std::mem::replace(&mut served.asked, true) { - let root = super::prefs::config_root(); + let root = crate::state::prefs::config_root(); std::thread::spawn(move || { let kept = root.map_or_else(Vocabulary::default, |root| { Vocabulary::load(&names::vocabulary_file(&root)) @@ -86,7 +86,7 @@ pub(crate) fn vocabulary() -> Arc { fn corpus() -> &'static Vocabulary { static READ: std::sync::OnceLock = std::sync::OnceLock::new(); READ.get_or_init(|| { - let local = super::prefs::config_root().map(|root| root.join("gta6_names")); + let local = crate::state::prefs::config_root().map(|root| root.join("gta6_names")); or_io::container::rpf::NameResolver::load_with_sources(None, local.as_deref()) .vocabulary() .clone() @@ -123,7 +123,7 @@ pub(crate) fn texture_uses() -> Arc { } let none = Arc::new(TextureUses::new()); *slot = Some(Arc::clone(&none)); - if let Some(root) = super::prefs::config_root() { + if let Some(root) = crate::state::prefs::config_root() { std::thread::spawn(move || { let kept = names::load_texture_uses(&root); *uses_slot() = Some(Arc::new(kept)); @@ -283,7 +283,7 @@ fn name_textures( ) -> (usize, bool) { let spelled = (keys.iter()).filter_map(|key| Some((*key, vocabulary.name64(*key)?.to_string()))); - let mut named = super::ttpf_document::learn_named(spelled); + let mut named = crate::state::ttpf_document::learn_named(spelled); let (total, done) = (vocabulary.len() as u64, AtomicU64::new(0)); let go_on = |more: usize| { let more = more as u64; @@ -297,7 +297,7 @@ fn name_textures( true => name_keys_by(vocabulary.plain_names(), keys, plain, &go_on), }; let found = found.into_iter().map(|(key, (name, _))| (key, name)); - named += super::ttpf_document::learn_named(found); + named += crate::state::ttpf_document::learn_named(found); if cancel.is_set() { return (named, true); } @@ -309,7 +309,7 @@ impl AppState { /// Harvest, as a job, the names the bodies of every GTA VI archive under `root` spell into /// the kept vocabulary, serve it, and name the keys of the folder's texture packs from it. pub fn harvest_gta6_names(&mut self, root: &Path) { - let Some(config) = super::prefs::config_root() else { + let Some(config) = crate::state::prefs::config_root() else { self.show_info_toast(tr!( "The names cannot be kept: this run has no configuration folder" )); @@ -318,7 +318,7 @@ impl AppState { if HARVESTING.swap(true, Ordering::Relaxed) { return; } - let packs = super::gta6_texture_index::pack_keys(root); + let packs = crate::state::gta6_texture_index::pack_keys(root); let doing = tr!( "Harvesting the names the GTA VI archives under {folder} spell", folder = root.display() @@ -371,7 +371,7 @@ impl AppState { pub fn harvest_names_of_the_open_gta6_folder(&mut self) { let is_gta_vi = |folder: &PathBuf| { let game = or_title::Game::detect_from_root(folder); - folder.is_dir() && game.is_some_and(super::gta_vi::read_by_scan) + folder.is_dir() && game.is_some_and(crate::state::gta_vi::read_by_scan) }; let tabs = (self.active_document().into_iter()).chain(self.documents.iter()); let root = tabs.filter_map(|doc| doc.path.clone()).find(is_gta_vi); diff --git a/src/state/gta6_object_trees.rs b/src/state/gta6/install/gta6_object_trees.rs similarity index 95% rename from src/state/gta6_object_trees.rs rename to src/state/gta6/install/gta6_object_trees.rs index 6f2579774..1aac2f3aa 100644 --- a/src/state/gta6_object_trees.rs +++ b/src/state/gta6/install/gta6_object_trees.rs @@ -5,7 +5,7 @@ use std::collections::BTreeSet; use or_io::gta6::headerless::read_object_trees; /// One line for the table, then one for each tree: its root's key and type, and what it points at. -pub(super) fn lines(bytes: &[u8]) -> Result, String> { +pub(in crate::state) fn lines(bytes: &[u8]) -> Result, String> { let trees = read_object_trees(bytes).map_err(|e| { tr!( "GTA VI's object-tree reader does not read this body: {e}", @@ -29,7 +29,7 @@ pub(super) fn lines(bytes: &[u8]) -> Result, String> { "{key}: a root of type {tag}, alone in its tree; it points at [{children}]", "{key}: a root of type {tag} and {count} objects in its tree; it points at [{children}]", tree.len(), - key = super::gta6_names::said32(root.key), + key = crate::state::gta6_names::said32(root.key), tag = format!("{:#010X}", root.type_tag), children = children.join(", "), )); diff --git a/src/state/gta6_small.rs b/src/state/gta6/install/gta6_small.rs similarity index 89% rename from src/state/gta6_small.rs rename to src/state/gta6/install/gta6_small.rs index 54368d503..fecdac68f 100644 --- a/src/state/gta6_small.rs +++ b/src/state/gta6/install/gta6_small.rs @@ -5,11 +5,11 @@ use or_io::gta6::headerless::{AssetIndex, KeyedBlobDescriptor, NeighbourTable}; /// A 64-bit key by the name the harvested vocabulary holds for it, else `hash_` and its digits. fn key_name(key: u64) -> String { - super::gta6_names::said64(key) + crate::state::gta6_names::said64(key) } /// A descriptor's key, stream length, pair and words. -pub(super) fn descriptor_lines(d: &KeyedBlobDescriptor, lines: &mut Vec) { +pub(in crate::state) fn descriptor_lines(d: &KeyedBlobDescriptor, lines: &mut Vec) { let words: Vec = d.words.iter().map(|w| format!("{w:#X}")).collect(); lines.push(tr!( "A descriptor of the keyed blob of key {key}, the blob after it that states the same key: a stream of {size} and the pair {first}, {second} at 0x50.", @@ -25,7 +25,7 @@ pub(super) fn descriptor_lines(d: &KeyedBlobDescriptor, lines: &mut Vec) } /// An asset index's assets with their value records, then each key of tables 1 to 4 with its assets. -pub(super) fn index_lines(index: &AssetIndex, lines: &mut Vec) { +pub(in crate::state) fn index_lines(index: &AssetIndex, lines: &mut Vec) { lines.push(tr!( "An asset index of {assets} assets, each keyed by the 64-bit hash of its name. What an asset's value record holds is not known, so it is kept as it is.", assets = index.assets.len(), @@ -51,7 +51,7 @@ pub(super) fn index_lines(index: &AssetIndex, lines: &mut Vec) { } /// A neighbour table's element count, then each element's four neighbours. -pub(super) fn neighbour_lines(table: &NeighbourTable, lines: &mut Vec) { +pub(in crate::state) fn neighbour_lines(table: &NeighbourTable, lines: &mut Vec) { lines.push(tr!( "A table of {elements} elements of four neighbours each, every one another element's index. Which mesh it belongs to is not known.", elements = table.elements.len(), diff --git a/src/state/gta_vi.rs b/src/state/gta6/install/gta_vi.rs similarity index 95% rename from src/state/gta_vi.rs rename to src/state/gta6/install/gta_vi.rs index ed21fec1b..8751daa56 100644 --- a/src/state/gta_vi.rs +++ b/src/state/gta6/install/gta_vi.rs @@ -6,7 +6,7 @@ use std::path::{Path, PathBuf}; use or_io::container::rpf::{Rpf9Header, RPF9_HEADER_SIZE, RPF9_MAGIC}; use or_title::ContainerFamily; -use super::prefs::{Game, Prefs}; +use crate::state::prefs::{Game, Prefs}; /// The GTA VI install the preferences hold: the active game's where it is a build of GTA VI, else the first build's with a folder set. pub(crate) fn install(prefs: &Prefs) -> Option<(Game, &PathBuf)> { @@ -61,7 +61,7 @@ pub(crate) fn rpf9_cut_short_at(path: &Path) -> Option { } /// Why the RPF9 archive at `path` did not open with the reader's `error`: cut short, no key, or a table the keys held do not open; `None` when it is not RPF9. -pub(super) fn rpf9_unopened_at(path: &Path, error: &or_io::Error) -> Option { +pub(in crate::state) fn rpf9_unopened_at(path: &Path, error: &or_io::Error) -> Option { if let Some(short) = rpf9_cut_short_at(path) { return Some(short); } @@ -73,7 +73,7 @@ pub(super) fn rpf9_unopened_at(path: &Path, error: &or_io::Error) -> Option Option { +pub(in crate::state) fn rpf9_refusal(head: &[u8]) -> Option { let header = Rpf9Header::parse(head).ok()?; Some(format!("{}\n{}", rpf9_why(), rpf9_facts(&header))) } @@ -106,7 +106,7 @@ pub(crate) fn rpf9_facts(header: &Rpf9Header) -> String { } /// [`rpf9_refusal`] for the file at `path`, of which only the header is read. -pub(super) fn rpf9_refusal_at(path: &Path) -> Option { +pub(in crate::state) fn rpf9_refusal_at(path: &Path) -> Option { let mut head = [0u8; RPF9_HEADER_SIZE]; std::fs::File::open(path) .and_then(|mut file| file.read_exact(&mut head)) @@ -115,7 +115,7 @@ pub(super) fn rpf9_refusal_at(path: &Path) -> Option { } /// The title the folder at `root` holds, or else `game`, when OpenRage cannot read that title yet. -pub(super) fn unsupported_title(game: Game, root: &Path) -> Option { +pub(in crate::state) fn unsupported_title(game: Game, root: &Path) -> Option { (Game::detect_from_root(root).into_iter().chain([game])) .find(|title| !title.profile().is_supported()) } @@ -126,7 +126,7 @@ fn why_unsupported(title: Game) -> String { } /// Why the folder at `root` is not opened as `game`'s install; `None` when it may be. -pub(super) fn refused_install(game: Game, root: &Path) -> Option { +pub(in crate::state) fn refused_install(game: Game, root: &Path) -> Option { let detected = Game::detect_from_root(root); if let Some(title) = unsupported_title(game, root) { // ⚠ A folder picked for the title and found to hold none of it is not that title: saying it is sent the person looking for a key. @@ -160,11 +160,11 @@ pub(super) fn refused_install(game: Game, root: &Path) -> Option { /// Whether `root` holds `game`, a title OpenRage cannot open as an install yet, whose folder is /// remembered and opened as a plain folder. -pub(super) fn holds_unsupported(game: Game, root: &Path) -> bool { +pub(in crate::state) fn holds_unsupported(game: Game, root: &Path) -> bool { !game.profile().is_supported() && Game::detect_from_root(root) == Some(game) } -impl super::AppState { +impl crate::state::AppState { /// Open `root` as `game`, a title that is not supported: one read by scan opens as the active /// install, any other is remembered, made active and opened as a plain folder; a folder that /// holds another title is refused. @@ -178,7 +178,7 @@ impl super::AppState { self.set_game_install_folder(game, Some(root.clone())); if self.prefs.game_paths.get(game) == Some(&root) { self.prefs.active_game = Some(game); - super::save_prefs(&self.prefs); + crate::state::save_prefs(&self.prefs); self.open_folder(root); } } @@ -191,7 +191,7 @@ pub(crate) fn read_by_scan(game: Game) -> bool { /// What opening the folder at `root` says when it holds a title that is not opened as an install, /// and whether that is a warning: a title read by scan is browsed as it is meant to be. -pub(super) fn plain_folder_note(root: &Path) -> Option<(String, bool)> { +pub(in crate::state) fn plain_folder_note(root: &Path) -> Option<(String, bool)> { folder_note( root, crate::state::rpf9_scan::rpf9_table::gta6_keys_held::gta6_keys, @@ -267,7 +267,7 @@ mod tests { head } - use super::super::{AppState, DocumentKind, Prefs, ToastType}; + use crate::state::{AppState, DocumentKind, Prefs, ToastType}; use std::path::PathBuf; /// A scratch folder laid out as a GTA VI package is: a title configuration naming GTA VI, and an RPF9 `common.rpf` with bytes past its head. @@ -300,7 +300,7 @@ mod tests { let archive = dir.join("common.rpf"); let found = std::fs::metadata(&archive).expect("the archive").len(); let header = Rpf9Header::parse(&rpf9_head(418)).expect("the head parses"); - let keys = super::super::rpf_archive_open::tree_verbs::tests::synthetic_keys() + let keys = crate::state::rpf_archive_open::tree_verbs::tests::synthetic_keys() .expect("the synthetic snapshot parses"); let keyed = |path: &Path| { let mut file = std::fs::File::open(path).expect("the archive"); @@ -387,7 +387,7 @@ mod tests { // A file inside it is a file of GTA VI's install, as the write gate sees it. let prefs = Prefs::default(); assert_eq!( - super::super::retail::game_of(&dir.join("common.rpf"), &prefs), + crate::state::retail::game_of(&dir.join("common.rpf"), &prefs), Some(Game::GtaVI) ); diff --git a/src/state/gta6/install/mod.rs b/src/state/gta6/install/mod.rs new file mode 100644 index 000000000..f74ca4392 --- /dev/null +++ b/src/state/gta6/install/mod.rs @@ -0,0 +1,10 @@ +pub(crate) mod gta6_first_entry; +pub(crate) mod gta6_install_harvest; +pub(crate) mod gta6_install_scan; +pub(crate) mod gta6_key_words; +pub(crate) mod gta6_learned_names; +pub(crate) mod gta6_name_pool; +pub(crate) mod gta6_names; +pub(crate) mod gta6_object_trees; +pub(crate) mod gta6_small; +pub(crate) mod gta_vi; diff --git a/src/state/gta6/mod.rs b/src/state/gta6/mod.rs new file mode 100644 index 000000000..8da7c540f --- /dev/null +++ b/src/state/gta6/mod.rs @@ -0,0 +1,12 @@ +//! GTA VI resource reading, editing, saving, world viewing, and modding state. + +pub(crate) mod anim; +pub(crate) mod audio; +pub(crate) mod bodies; +pub(crate) mod drawable; +pub(crate) mod install; +pub(crate) mod modding; +pub(crate) mod particles; +pub(crate) mod physics; +pub(crate) mod textures; +pub(crate) mod world; diff --git a/src/state/gta6_modding/anim_replace.rs b/src/state/gta6/modding/anim_replace.rs similarity index 100% rename from src/state/gta6_modding/anim_replace.rs rename to src/state/gta6/modding/anim_replace.rs diff --git a/src/state/gta6_modding/audio_replace.rs b/src/state/gta6/modding/audio_replace.rs similarity index 100% rename from src/state/gta6_modding/audio_replace.rs rename to src/state/gta6/modding/audio_replace.rs diff --git a/src/state/gta6_modding/batch_export.rs b/src/state/gta6/modding/batch_export.rs similarity index 100% rename from src/state/gta6_modding/batch_export.rs rename to src/state/gta6/modding/batch_export.rs diff --git a/src/state/gta6_modding/mod.rs b/src/state/gta6/modding/mod.rs similarity index 100% rename from src/state/gta6_modding/mod.rs rename to src/state/gta6/modding/mod.rs diff --git a/src/state/gta6_modding/mod_package.rs b/src/state/gta6/modding/mod_package/mod.rs similarity index 99% rename from src/state/gta6_modding/mod_package.rs rename to src/state/gta6/modding/mod_package/mod.rs index 6c170e8f7..30306ab5e 100644 --- a/src/state/gta6_modding/mod_package.rs +++ b/src/state/gta6/modding/mod_package/mod.rs @@ -633,5 +633,4 @@ impl AppState { } #[cfg(test)] -#[path = "mod_package_tests.rs"] mod tests; diff --git a/src/state/gta6_modding/mod_package_tests.rs b/src/state/gta6/modding/mod_package/tests.rs similarity index 100% rename from src/state/gta6_modding/mod_package_tests.rs rename to src/state/gta6/modding/mod_package/tests.rs diff --git a/src/state/gta6_modding/mod_package_changes.rs b/src/state/gta6/modding/mod_package_changes.rs similarity index 100% rename from src/state/gta6_modding/mod_package_changes.rs rename to src/state/gta6/modding/mod_package_changes.rs diff --git a/src/state/gta6_modding/mod_package_install.rs b/src/state/gta6/modding/mod_package_install/mod.rs similarity index 99% rename from src/state/gta6_modding/mod_package_install.rs rename to src/state/gta6/modding/mod_package_install/mod.rs index f3de109cb..171967fa8 100644 --- a/src/state/gta6_modding/mod_package_install.rs +++ b/src/state/gta6/modding/mod_package_install/mod.rs @@ -358,5 +358,4 @@ impl AppState { } #[cfg(test)] -#[path = "mod_package_install_tests.rs"] mod tests; diff --git a/src/state/gta6_modding/mod_package_install_tests.rs b/src/state/gta6/modding/mod_package_install/tests.rs similarity index 100% rename from src/state/gta6_modding/mod_package_install_tests.rs rename to src/state/gta6/modding/mod_package_install/tests.rs diff --git a/src/state/gta6_modding/model_replace.rs b/src/state/gta6/modding/model_replace/mod.rs similarity index 99% rename from src/state/gta6_modding/model_replace.rs rename to src/state/gta6/modding/model_replace/mod.rs index 1016f5bf6..b1bb75d04 100644 --- a/src/state/gta6_modding/model_replace.rs +++ b/src/state/gta6/modding/model_replace/mod.rs @@ -141,7 +141,7 @@ fn made(archive: &Path, offset: u64, earlier: &[Held], new: &Held) -> Result Named { } /// Keep what `list`, opened from `path`, names. -pub(super) fn keep(path: &Path, list: &ParticleEffects) { +pub(in crate::state) fn keep(path: &Path, list: &ParticleEffects) { lock(&KEPT).insert(path.to_path_buf(), Arc::new(named(list))); } @@ -147,7 +147,7 @@ fn drawables_at(file: &File, offset: u64, wanted: &BTreeSet) -> Vec<(u32, D } /// A search; a new one replaces the one running, and dropping it stops it. -pub(super) struct ModelFinding { +pub(in crate::state) struct ModelFinding { cancel: Cancel, progress: Progress, ended: Arc>>, @@ -221,7 +221,7 @@ impl Drop for ModelFinding { impl AppState { /// The job list's row for the search, while it runs. - pub(super) fn particle_model_finding_job(&self) -> Option { + pub(in crate::state) fn particle_model_finding_job(&self) -> Option { let finding = self.particle_model_finding.as_ref()?; if finding.ended().is_some() { return None; @@ -236,7 +236,7 @@ impl AppState { } /// Ask the search to stop; it says it stopped once its worker sees the stop. - pub(super) fn stop_particle_model_finding(&self) { + pub(in crate::state) fn stop_particle_model_finding(&self) { if let Some(finding) = &self.particle_model_finding { finding.cancel.set(); } @@ -254,7 +254,7 @@ impl AppState { if wanted.is_empty() { return Ok(()); } - let (_, bodies) = super::gta6_dictionary_index::whole_scans(&self.documents, true); + let (_, bodies) = crate::state::gta6_dictionary_index::whole_scans(&self.documents, true); if bodies.is_empty() { return Err( tr!("Open the whole scan of an archive to look for the drawables in.").to_string(), @@ -266,7 +266,7 @@ impl AppState { /// Say in the job list how the search ended, once it has, and drop it; a drawable found /// rebuilds the effect the preview plays, so its mesh domains take the model's surface. - pub(super) fn poll_particle_model_finding(&mut self) { + pub(in crate::state) fn poll_particle_model_finding(&mut self) { let Some(ended) = (self.particle_model_finding.as_ref()).and_then(ModelFinding::ended) else { return; @@ -299,9 +299,9 @@ impl AppState { /// Give each mesh domain of the effects the preview plays from `doc`, of any slot, the surface /// of the model it names, where a search found it; one whose model was not found keeps its shape. /// Each emitter takes its rule's third spawner too, and every effect spawned later its own. - pub(super) fn give_gta6_domain_meshes(&mut self, doc: DocumentId) { + pub(in crate::state) fn give_gta6_domain_meshes(&mut self, doc: DocumentId) { let path = self.document(doc).and_then(|d| d.path.as_deref()); - let spawners = path.and_then(super::gta6_particles::spawners::of); + let spawners = path.and_then(crate::state::gta6_particles::spawners::of); let named = path.and_then(kept); let manager = &mut self.sim.manager; manager.zcull_spawners = spawners.map(|s| (*s).clone()).unwrap_or_default(); diff --git a/src/state/gta6_particle_colour.rs b/src/state/gta6/particles/gta6_particles/colour_max.rs similarity index 100% rename from src/state/gta6_particle_colour.rs rename to src/state/gta6/particles/gta6_particles/colour_max.rs diff --git a/src/state/gta6_particles.rs b/src/state/gta6/particles/gta6_particles/mod.rs similarity index 97% rename from src/state/gta6_particles.rs rename to src/state/gta6/particles/gta6_particles/mod.rs index 642e9a8bb..fa1b7e459 100644 --- a/src/state/gta6_particles.rs +++ b/src/state/gta6/particles/gta6_particles/mod.rs @@ -17,18 +17,14 @@ use or_io::gta6::headerless::{ ParticleEffects, ParticleRule, SpawnedScalars, Spawner, DOMAIN_KFPS, EFFECT_KFPS, EMITTER_KFPS, }; -use super::DocPayload; +use crate::state::DocPayload; -#[path = "gta6_particle_sprites.rs"] pub(crate) mod sprites; -#[path = "gta6_particle_raw.rs"] mod raw; -#[path = "gta6_particle_spawners.rs"] pub(crate) mod spawners; -#[path = "gta6_particle_colour.rs"] pub(crate) mod colour_max; /// The highest alignment mode GTA V's sprite names. @@ -50,7 +46,7 @@ fn scanned() -> MutexGuard<'static, BTreeMap>>> { } /// A scanned particle effects list as GTA V's, where it reads; its own lines are kept for `path`. -pub(super) fn opened( +pub(in crate::state) fn opened( path: &Path, signature: Rpf9Signature, resource: &Rpf9Resource, @@ -66,7 +62,7 @@ pub(super) fn opened( scanned().insert(path.to_path_buf(), Arc::new(lines(&list))); sprites::keep(path, &list); spawners::keep(path, &list); - super::gta6_particle_models::keep(path, &list); + crate::state::gta6_particle_models::keep(path, &list); Some(DocPayload::Resource(or_io::Asset::Particles(ypt))) } @@ -76,13 +72,16 @@ pub(crate) fn scanned_lines(path: &Path) -> Option>> { } /// Whether `doc` is a scanned GTA VI list, saved in place, so no rule is made in it from nothing. -pub(crate) fn written_in_place(state: &super::AppState, doc: super::DocumentId) -> bool { +pub(crate) fn written_in_place( + state: &crate::state::AppState, + doc: crate::state::DocumentId, +) -> bool { let path = state.document(doc).and_then(|d| d.path.as_deref()); path.is_some_and(|p| scanned_lines(p).is_some()) } /// The list as GTA V's, its rules in their dictionaries and named by the events and spawners. -pub(super) fn as_ypt(list: &ParticleEffects) -> PtxFxList { +pub(in crate::state) fn as_ypt(list: &ParticleEffects) -> PtxFxList { PtxFxList { name: list.name.clone(), effect_rule_dict: dictionary( @@ -404,7 +403,7 @@ fn aged(b: &Behaviour, place: usize) -> bool { } /// The GTA V behaviour of `b`'s class with the values GTA V names; `None` for a class not known. -pub(super) fn behaviour(b: &Behaviour, place: usize) -> Option { +pub(in crate::state) fn behaviour(b: &Behaviour, place: usize) -> Option { use PtxBehaviourAny as B; let k = |id: u32| kfp_of(b, id, id); if aged(b, place) { @@ -583,7 +582,7 @@ pub(super) fn behaviour(b: &Behaviour, place: usize) -> Option } /// `held` given what its GTA V form `b` writes back: a sprite's flip chances, a ZCull's mode. -pub(super) fn written_fields(b: &PtxBehaviourAny, held: &mut Behaviour) { +pub(in crate::state) fn written_fields(b: &PtxBehaviourAny, held: &mut Behaviour) { match (b, &mut held.fields) { (PtxBehaviourAny::PtxdSprite(s), BehaviourFields::Sprite { flip_chance, .. }) => { *flip_chance = [s.flip_chance_u, s.flip_chance_v]; @@ -594,7 +593,7 @@ pub(super) fn written_fields(b: &PtxBehaviourAny, held: &mut Behaviour) { } /// What the list states that its GTA V form has no place for, and what is not known. -pub(super) fn lines(list: &ParticleEffects) -> Vec { +pub(in crate::state) fn lines(list: &ParticleEffects) -> Vec { let mut lines = vec![ tr!( "A GTA VI particle effects list named {name}: {effects} effect rules, {emitters} emitter rules and {particles} particle rules, shown in the Particle workspace as a GTA V list built from them.", @@ -795,5 +794,4 @@ fn shading_lines(list: &ParticleEffects, p: &ParticleRule, lines: &mut Vec Result { read_particle_effects(&s.virtual_section, None).map_err(|e| e.to_string()) diff --git a/src/state/gta6_particles_save.rs b/src/state/gta6/particles/gta6_particles_save/mod.rs similarity index 95% rename from src/state/gta6_particles_save.rs rename to src/state/gta6/particles/gta6_particles_save/mod.rs index a9160e32c..994a641a9 100644 --- a/src/state/gta6_particles_save.rs +++ b/src/state/gta6/particles/gta6_particles_save/mod.rs @@ -20,29 +20,27 @@ use or_particle::list::{ canonical, effect_rules, effect_rules_mut, emitter_rules, events, events_mut, particle_rules, }; -#[path = "gta6_particles_remove.rs"] -pub(super) mod remove; +pub(crate) mod remove; -#[path = "gta6_particles_copies.rs"] mod copies; -use super::document::Document; -use super::gta6_edit::EditSections; -use super::gta6_resource_save::EditedSave; -use super::DocPayload; +use crate::state::document::Document; +use crate::state::gta6_edit::EditSections; +use crate::state::gta6_resource_save::EditedSave; +use crate::state::DocPayload; /// The Ypt row's `edited_sections` where `document` is a scanned GTA VI list holding an edit: its /// body read again on the worker and its values written over it; `None` for any other document. -pub(super) fn edited_save(document: &Document) -> Option> { +pub(in crate::state) fn edited_save(document: &Document) -> Option> { if !document.history.can_undo() { return None; } let path = document.path.as_deref()?; - super::gta6_particles::scanned_lines(path)?; + crate::state::gta6_particles::scanned_lines(path)?; let DocPayload::Resource(or_io::Asset::Particles(ypt)) = &document.payload else { return None; }; - let (archive, offset) = super::rpf9_scan::scanned_body(path)?; + let (archive, offset) = crate::state::rpf9_scan::scanned_body(path)?; let ypt = ypt.clone(); let edit: Arc = Arc::new(move |_, sections: &mut Rpf9Sections| { // Every write goes to a copy, so a refused one leaves the sections as they were. @@ -84,7 +82,7 @@ fn moved() -> String { /// `stored` given the values its GTA V form `ypt` shows; refused where an edit of `ypt` has no /// place in the GTA VI list. -pub(super) fn from_ypt( +pub(in crate::state) fn from_ypt( stored: &ParticleEffects, ypt: &PtxFxList, ) -> Result { @@ -114,7 +112,7 @@ pub(super) fn from_ypt( for (i, from) in particles.into_iter().enumerate() { particle(&mut list, i, from)?; } - let mut back = super::gta6_particles::as_ypt(&list); + let mut back = crate::state::gta6_particles::as_ypt(&list); canonical(&mut back); if back != edited { return Err(tr!("An edit has no place in the GTA VI particle list, which keeps only the values both games share: undo it to save the others.").to_string()); @@ -128,7 +126,7 @@ fn not_a_copy() -> String { /// Each effect `ypt` holds that `stored` does not, with the stored effect it copies: the one whose /// name followed by `_copy` begins its name, the longest where several do. -pub(super) fn duplicates( +pub(in crate::state) fn duplicates( stored: &ParticleEffects, ypt: &PtxFxList, ) -> Result, String> { @@ -346,7 +344,7 @@ fn particle( let mut shown = Vec::new(); for (place, &b) in listed.iter().enumerate() { let held = list.behaviours.get(b); - let shows = held.and_then(|held| super::gta6_particles::behaviour(held, place)); + let shows = held.and_then(|held| crate::state::gta6_particles::behaviour(held, place)); if shows.is_some() { shown.push(b); } @@ -366,11 +364,11 @@ fn particle( }; // Only an edit of the enable shown changes the count, which may read on and be shown off. if let PtxBehaviourAny::PtxuColour(c) = b { - if c.rgba_max_enable != super::gta6_particles::colour_max::max_enable(held) { + if c.rgba_max_enable != crate::state::gta6_particles::colour_max::max_enable(held) { held.fields = held.fields.with_colour_max_enabled(c.rgba_max_enable.get()); } } - super::gta6_particles::written_fields(b, held); + crate::state::gta6_particles::written_fields(b, held); for (id, prop) in behaviour_kfps(b) { if let Some(k) = held.kfps.iter_mut().find(|k| k.id == id) { keys(k, prop); diff --git a/src/state/gta6_particles_remove.rs b/src/state/gta6/particles/gta6_particles_save/remove.rs similarity index 100% rename from src/state/gta6_particles_remove.rs rename to src/state/gta6/particles/gta6_particles_save/remove.rs diff --git a/src/state/gta6/particles/mod.rs b/src/state/gta6/particles/mod.rs new file mode 100644 index 000000000..1c89ed3e9 --- /dev/null +++ b/src/state/gta6/particles/mod.rs @@ -0,0 +1,3 @@ +pub(crate) mod gta6_particle_models; +pub(crate) mod gta6_particles; +pub(crate) mod gta6_particles_save; diff --git a/src/state/gta6_bound.rs b/src/state/gta6/physics/gta6_bound.rs similarity index 96% rename from src/state/gta6_bound.rs rename to src/state/gta6/physics/gta6_bound.rs index dd2c9e2cf..1f15cbcf0 100644 --- a/src/state/gta6_bound.rs +++ b/src/state/gta6/physics/gta6_bound.rs @@ -3,7 +3,7 @@ use or_io::gta6::headerless::{material_key, Bound, BoundChild, Bvh, ChildBound, Primitive}; -use super::selection::SelectionKey; +use crate::state::selection::SelectionKey; /// The selection of child `index`; the bound itself is [`SelectionKey::Root`]. pub(crate) fn child_row(index: usize) -> SelectionKey { @@ -65,7 +65,7 @@ pub(crate) fn child_label(index: usize, child: &BoundChild) -> (String, String) None => (tr!("Child {index}: null", index = index), String::new()), Some(Err(e)) => (tr!("Child {index}: not read", index = index), e.to_string()), Some(Ok(shape)) => { - let name = super::gta6_resource::shape_name(shape).unwrap_or(tr!("geometry")); + let name = crate::state::gta6_resource::shape_name(shape).unwrap_or(tr!("geometry")); let detail = match (shape, shape.extent()) { (ChildBound::Geometry(g), _) => tr!( "{vertices} vertices, {primitives} primitives", @@ -127,7 +127,7 @@ pub(crate) fn child_rows(child: &BoundChild) -> Vec<(String, String)> { let Some(Ok(shape)) = &child.bound else { return rows; }; - let name = super::gta6_resource::shape_name(shape).unwrap_or(tr!("geometry")); + let name = crate::state::gta6_resource::shape_name(shape).unwrap_or(tr!("geometry")); rows.push((tr!("Type").to_string(), name.to_string())); if let Some((half, radius)) = shape.extent() { rows.push((tr!("Half extents").to_string(), point(half))); diff --git a/src/state/gta6_bound_vertex.rs b/src/state/gta6/physics/gta6_bound_vertex.rs similarity index 98% rename from src/state/gta6_bound_vertex.rs rename to src/state/gta6/physics/gta6_bound_vertex.rs index 4127112c3..33ae2a8f9 100644 --- a/src/state/gta6_bound_vertex.rs +++ b/src/state/gta6/physics/gta6_bound_vertex.rs @@ -5,8 +5,8 @@ use std::sync::Arc; use or_io::gta6::headerless::{vertex_move_holds, BoundGeometry, ChildBound, Resource}; -use super::edit_history::Change; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::edit_history::Change; +use crate::state::{AppState, DocPayload, DocumentId}; /// Geometry child `child` of the bound a body is, or of the one a drawable or a fragment embeds. fn geometry_mut(payload: &mut DocPayload, child: usize) -> Option<&mut BoundGeometry> { diff --git a/src/state/gta6_collision_edit.rs b/src/state/gta6/physics/gta6_collision_edit/mod.rs similarity index 98% rename from src/state/gta6_collision_edit.rs rename to src/state/gta6/physics/gta6_collision_edit/mod.rs index a2227cc7a..a2e311f64 100644 --- a/src/state/gta6_collision_edit.rs +++ b/src/state/gta6/physics/gta6_collision_edit/mod.rs @@ -9,8 +9,8 @@ use or_io::gta6::headerless::{ rewire_triangle, DrawableWithBound, Resource, }; -use super::gta6_physics_edit::{bound_mut, geometry_mut}; -use super::{AppState, Change, DocPayload, DocumentId, Swap}; +use crate::state::gta6_physics_edit::{bound_mut, geometry_mut}; +use crate::state::{AppState, Change, DocPayload, DocumentId, Swap}; /// What a reshape of a GTA VI bound or fragment sets. #[derive(Debug, Clone, Copy, PartialEq)] @@ -114,7 +114,7 @@ impl AppState { .ok_or_else(|| { tr!("This document has no file, so it holds no GTA VI skeleton.") })?; - super::rpf9_scan::scanned_skeleton(&path)?.bones + crate::state::rpf9_scan::scanned_skeleton(&path)?.bones } _ => Vec::new(), }; @@ -269,5 +269,4 @@ impl AppState { } #[cfg(test)] -#[path = "gta6_collision_edit_tests.rs"] mod tests; diff --git a/src/state/gta6_collision_edit_tests.rs b/src/state/gta6/physics/gta6_collision_edit/tests.rs similarity index 100% rename from src/state/gta6_collision_edit_tests.rs rename to src/state/gta6/physics/gta6_collision_edit/tests.rs diff --git a/src/state/gta6_navmesh.rs b/src/state/gta6/physics/gta6_navmesh.rs similarity index 96% rename from src/state/gta6_navmesh.rs rename to src/state/gta6/physics/gta6_navmesh.rs index ca695aa2f..5e22542df 100644 --- a/src/state/gta6_navmesh.rs +++ b/src/state/gta6/physics/gta6_navmesh.rs @@ -10,9 +10,9 @@ use or_io::container::rpf::{read_rpf9_body, Rpf9BodyKind, Rpf9ScanFind, Rpf9Zlib use or_io::gta6::headerless::{joins, Border, NavMesh, SpecialLink}; use or_job::{Cancel, Progress}; -use super::jobs::{JobKind, Outcome, RunningJob, Then}; -use super::rpf9_scan::{body_path, view_of, Row}; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::jobs::{JobKind, Outcome, RunningJob, Then}; +use crate::state::rpf9_scan::{body_path, view_of, Row}; +use crate::state::{AppState, DocPayload, DocumentId}; const BORDERS: [Border; 4] = [Border::East, Border::West, Border::North, Border::South]; @@ -26,10 +26,10 @@ fn cells() -> MutexGuard<'static, BTreeMap>> { } /// Keep `mesh`, the cell the body at `path` opened to, with none of an earlier session's deletions. -pub(super) fn remember(path: &Path, mesh: NavMesh) { - super::gta6_navmesh_delete::forget(path); +pub(in crate::state) fn remember(path: &Path, mesh: NavMesh) { + crate::state::gta6_navmesh_delete::forget(path); // A body whose links an edit of another cell renumbered keeps them while that edit holds. - if super::gta6_navmesh_delete::links::renumbered_by(path).is_some() { + if crate::state::gta6_navmesh_delete::links::renumbered_by(path).is_some() { return; } cells().insert(path.to_path_buf(), Arc::new(mesh)); @@ -42,7 +42,7 @@ pub(crate) fn scanned_cell(path: &Path) -> Option> { /// Keep `mesh` as the cell the document at `path` shows now, returning the one it held; `None`, /// changing nothing, where no cell is kept there. -pub(super) fn replace(path: &Path, mesh: Arc) -> Option> { +pub(in crate::state) fn replace(path: &Path, mesh: Arc) -> Option> { cells() .get_mut(path) .map(|held| std::mem::replace(held, mesh)) @@ -195,7 +195,7 @@ fn link_line(m: &NavMesh, i: usize, link: &SpecialLink) -> String { } /// The polygon GTA V's edge for the edge at `index` names: its fifteen bits name none past 32,766. -pub(super) fn view_neighbour(m: &NavMesh, index: usize) -> usize { +pub(in crate::state) fn view_neighbour(m: &NavMesh, index: usize) -> usize { use or_io::gta5::navmesh::NO_NEIGHBOUR; (m.neighbour(index)) .filter(|p| *p < NO_NEIGHBOUR) @@ -205,7 +205,7 @@ pub(super) fn view_neighbour(m: &NavMesh, index: usize) -> usize { /// Per polygon, whether no open edge of the view's model `mesh` joins it to a polygon of the cell /// `m`, out or in, at any polygon count; `None` where the two hold other numbers of edges. pub(crate) fn disabled_polygons(mesh: &or_io::gta5::CNavMesh, m: &NavMesh) -> Option> { - let open = super::gta6_navmesh_edit::open_edges(mesh); + let open = crate::state::gta6_navmesh_edit::open_edges(mesh); if open.len() != m.edges.len() { return None; } @@ -304,7 +304,7 @@ pub(crate) fn linked_cells(path: &Path, m: &NavMesh) -> Vec<(u32, Option Vec<(PathBuf, Arc)> { +pub(in crate::state) fn neighbour_paths(path: &Path, m: &NavMesh) -> Vec<(PathBuf, Arc)> { if m.cell == 0 { return Vec::new(); } @@ -354,7 +354,7 @@ type Searched = Result, Option>; /// A search of a scan's navigation cells for those across a cell's borders, on a worker. // ponytail: one search at a time; a new one replaces it and stops it. -pub(super) struct Search { +pub(in crate::state) struct Search { cancel: Cancel, progress: Progress, ended: Arc>>, @@ -368,7 +368,7 @@ impl Drop for Search { /// The bodies of `wanted` cells among `finds` of `archive`, read one after another: where a cell /// has several, the second in archive order. -pub(super) fn find_cells( +pub(in crate::state) fn find_cells( archive: &Path, finds: &[Rpf9ScanFind], wanted: &[u32], @@ -467,7 +467,7 @@ impl AppState { } /// Open the cells the search found and say how it ended, once. - pub(super) fn poll_neighbour_search(&mut self) { + pub(in crate::state) fn poll_neighbour_search(&mut self) { let ended = (self.neighbour_search.as_ref()).and_then(|s| s.ended.lock().ok()?.take()); if ended.is_some() { self.neighbour_search = None; @@ -494,7 +494,7 @@ impl AppState { } /// The search while it runs, as the job list draws it. - pub(super) fn neighbour_search_job(&self) -> Option { + pub(in crate::state) fn neighbour_search_job(&self) -> Option { let s = self.neighbour_search.as_ref()?; if s.ended.lock().ok()?.is_some() { return None; @@ -508,7 +508,7 @@ impl AppState { }) } - pub(super) fn stop_neighbour_search(&self) { + pub(in crate::state) fn stop_neighbour_search(&self) { if let Some(s) = &self.neighbour_search { s.cancel.set(); } diff --git a/src/state/gta6_navmesh_links.rs b/src/state/gta6/physics/gta6_navmesh_delete/links.rs similarity index 100% rename from src/state/gta6_navmesh_links.rs rename to src/state/gta6/physics/gta6_navmesh_delete/links.rs diff --git a/src/state/gta6_navmesh_look.rs b/src/state/gta6/physics/gta6_navmesh_delete/look.rs similarity index 100% rename from src/state/gta6_navmesh_look.rs rename to src/state/gta6/physics/gta6_navmesh_delete/look.rs diff --git a/src/state/gta6_navmesh_delete.rs b/src/state/gta6/physics/gta6_navmesh_delete/mod.rs similarity index 95% rename from src/state/gta6_navmesh_delete.rs rename to src/state/gta6/physics/gta6_navmesh_delete/mod.rs index 055f33ffd..b595920e1 100644 --- a/src/state/gta6_navmesh_delete.rs +++ b/src/state/gta6/physics/gta6_navmesh_delete/mod.rs @@ -16,19 +16,17 @@ use or_io::gta6::headerless::{ NOWHERE, }; -use super::edit_history::{Change, Swap}; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::edit_history::{Change, Swap}; +use crate::state::{AppState, DocPayload, DocumentId}; -#[path = "gta6_navmesh_links.rs"] -pub(super) mod links; +pub(crate) mod links; -#[path = "gta6_navmesh_look.rs"] mod look; /// A deletion, or a disable that moves the arrays, as a save makes it again: the polygon, and the /// records the cell held before it. #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub(super) struct Deletion { +pub(in crate::state) struct Deletion { polygon: usize, records: usize, disable: bool, @@ -44,7 +42,7 @@ fn deletions() -> MutexGuard<'static, BTreeMap>> { } /// Drop the deletions kept for `path`, whose body opens again as it is stored. -pub(super) fn forget(path: &Path) { +pub(in crate::state) fn forget(path: &Path) { deletions().remove(path); links::forget(path); } @@ -65,7 +63,8 @@ struct CellPart { impl Swap for CellPart { fn swap(&mut self, _: &mut DocPayload) -> bool { - let Some(now) = super::gta6_navmesh::replace(&self.path, Arc::clone(&self.cell)) else { + let Some(now) = crate::state::gta6_navmesh::replace(&self.path, Arc::clone(&self.cell)) + else { return false; }; self.cell = now; @@ -121,13 +120,13 @@ fn others( impl AppState { /// Polygon `polygon` of the scanned GTA VI cell `doc` deleted as one step, or why not; `None` /// for any other document. - pub(super) fn delete_gta6_polygon( + pub(in crate::state) fn delete_gta6_polygon( &mut self, doc: DocumentId, polygon: usize, ) -> Option> { let path = self.document(doc)?.path.clone()?; - let cell = super::gta6_navmesh::scanned_cell(&path)?; + let cell = crate::state::gta6_navmesh::scanned_cell(&path)?; Some(self.delete_in_cell(doc, &path, &cell, polygon)) } @@ -138,7 +137,7 @@ impl AppState { cell: &NavMesh, polygon: usize, ) -> Result { - let near = super::gta6_navmesh::linked_cells(path, cell); + let near = crate::state::gta6_navmesh::linked_cells(path, cell); let closed = (self.unopened(path, &near)).map_err(|cells| looking(polygon, &cells))?; let open = others(&closed, cell, &near, polygon)?; let bodies: Vec<&NavMesh> = open.iter().map(|b| &**b).collect(); @@ -177,7 +176,7 @@ impl AppState { /// Polygon `polygon` of the scanned cell `doc` cut off as one step where a side record naming /// it drops a corner, and how many edges now lead nowhere; `None` where the cut moves nothing. - pub(super) fn disable_rechained( + pub(in crate::state) fn disable_rechained( &mut self, doc: DocumentId, path: &Path, @@ -257,7 +256,8 @@ impl AppState { let mut planned = deletions().get(path).cloned().unwrap_or_default(); planned.push(step); tried(path, planned)?; - let held = super::gta6_navmesh::replace(path, Arc::new(made.mesh)).ok_or_else(closed)?; + let held = + crate::state::gta6_navmesh::replace(path, Arc::new(made.mesh)).ok_or_else(closed)?; if let Some(view) = self.document_mut(doc).and_then(|d| view_of(&mut d.payload)) { *view = edited; } @@ -302,11 +302,11 @@ impl AppState { /// `before`, the view of the cell it was made from. fn view_after(before: &CNavMesh, made: &NavRebuild) -> Result { let no_view = || tr!("The cell's view holds no edges.").to_string(); - let mut view = super::gta6_resource::cell_view(&made.mesh).ok_or_else(no_view)?; + let mut view = crate::state::gta6_resource::cell_view(&made.mesh).ok_or_else(no_view)?; let flags: Vec = (before.polys_array.as_deref()).map_or(Vec::new(), |l| { l.iter().map(TNavMeshPoly::as_integer1).collect() }); - let open = super::gta6_navmesh_edit::open_edges(before); + let open = crate::state::gta6_navmesh_edit::open_edges(before); let nowhere = TAdjPoly::leading_to(0, NO_NEIGHBOUR).map_err(|e| e.to_string())?; if let Some(polygons) = view.polys_array.as_deref_mut() { let all = (polygons.sub_arrays.iter_mut()).flat_map(|s| s.elements.iter_mut()); @@ -329,7 +329,10 @@ fn view_after(before: &CNavMesh, made: &NavRebuild) -> Result /// The deletions a save of the cell at `path` makes, and no neighbouring body: their links were /// made again at each step and are written beside the cell. -pub(super) fn saved_with(path: &Path, _cell: &NavMesh) -> (Vec, Vec>) { +pub(in crate::state) fn saved_with( + path: &Path, + _cell: &NavMesh, +) -> (Vec, Vec>) { ( deletions().get(path).cloned().unwrap_or_default(), Vec::new(), @@ -340,16 +343,16 @@ pub(super) fn saved_with(path: &Path, _cell: &NavMesh) -> (Vec, Vec) -> Result<(), String> { - let Some((archive, offset)) = super::rpf9_scan::scanned_body(path) else { + let Some((archive, offset)) = crate::state::rpf9_scan::scanned_body(path) else { return Ok(()); }; let edit = move |_, s: &mut Rpf9Sections| write_deletions(s, &made, &[]); - super::gta6_edit::written(archive, offset, &edit).map(drop) + crate::state::gta6_edit::written(archive, offset, &edit).map(drop) } /// `made` over the cell `sections` hold, in order, each where the cell holds the records it began /// from: a body saved with a deletion holds fewer, and it is not made twice. -pub(super) fn write_deletions( +pub(in crate::state) fn write_deletions( sections: &mut Rpf9Sections, made: &[Deletion], others: &[Arc], diff --git a/src/state/gta6_navmesh_edit.rs b/src/state/gta6/physics/gta6_navmesh_edit.rs similarity index 94% rename from src/state/gta6_navmesh_edit.rs rename to src/state/gta6/physics/gta6_navmesh_edit.rs index a896dd300..e8fd6429e 100644 --- a/src/state/gta6_navmesh_edit.rs +++ b/src/state/gta6/physics/gta6_navmesh_edit.rs @@ -10,8 +10,8 @@ use or_io::gta6::headerless::{ cut_edges, links_into, polygon_cut, read_navmesh, NavMesh, PolygonCut, }; -use super::edit_history::Change; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::edit_history::Change; +use crate::state::{AppState, DocPayload, DocumentId}; type Edges = Option>>; @@ -26,8 +26,11 @@ fn leads_somewhere(m: &NavMesh, index: usize) -> bool { } /// The view's edge for the cell's edge at `index`. -pub(super) fn view_edge(m: &NavMesh, index: usize) -> Result { - let polygon = super::gta6_navmesh::view_neighbour(m, index); +pub(in crate::state) fn view_edge( + m: &NavMesh, + index: usize, +) -> Result { + let polygon = crate::state::gta6_navmesh::view_neighbour(m, index); match polygon == NO_NEIGHBOUR && leads_somewhere(m, index) { true => TAdjPoly::leading_to(PAST, NO_NEIGHBOUR), false => TAdjPoly::leading_to(0, polygon), @@ -57,13 +60,13 @@ fn listed(items: &[usize]) -> String { impl AppState { fn gta6_cell(&self, doc: DocumentId) -> Option<(std::path::PathBuf, Arc)> { let path = self.document(doc)?.path.clone()?; - let cell = super::gta6_navmesh::scanned_cell(&path)?; + let cell = crate::state::gta6_navmesh::scanned_cell(&path)?; Some((path, cell)) } /// Polygon `polygon` of the scanned GTA VI cell `doc` cut off, as one step; what it did and /// what still reaches it, or why not. `None` for any other document. - pub(super) fn disable_gta6_polygon( + pub(in crate::state) fn disable_gta6_polygon( &mut self, doc: DocumentId, polygon: usize, @@ -80,7 +83,7 @@ impl AppState { polygon: usize, ) -> Result { let cut = polygon_cut(cell, polygon).map_err(|e| e.to_string())?; - let near = super::gta6_navmesh::linked_cells(path, cell); + let near = crate::state::gta6_navmesh::linked_cells(path, cell); let (cuts, in_place) = match self.disable_rechained(doc, path, cell, polygon, &near) { Some(made) => (made?, false), None => (self.cut_in_view(doc, &cut, polygon)?, true), @@ -179,13 +182,16 @@ impl AppState { } /// Per edge of the view's model of a scanned cell, whether it leads anywhere. -pub(super) fn open_edges(mesh: &CNavMesh) -> Vec { +pub(in crate::state) fn open_edges(mesh: &CNavMesh) -> Vec { (mesh.adjacent_polys_array.as_deref()).map_or(Vec::new(), |l| l.iter().map(is_open).collect()) } /// The edges a disable cut, written over the cell `virtual_section` holds: each the model leads /// nowhere where the body names a polygon. -pub(super) fn write_cuts(virtual_section: &mut [u8], open: &[bool]) -> Result<(), String> { +pub(in crate::state) fn write_cuts( + virtual_section: &mut [u8], + open: &[bool], +) -> Result<(), String> { let read = read_navmesh(virtual_section).map_err(|e| e.to_string())?; if open.len() != read.edges.len() { return Err( diff --git a/src/state/gta6_bound_reshape.rs b/src/state/gta6/physics/gta6_physics_edit/bound_reshape.rs similarity index 100% rename from src/state/gta6_bound_reshape.rs rename to src/state/gta6/physics/gta6_physics_edit/bound_reshape.rs diff --git a/src/state/gta6_physics_edit.rs b/src/state/gta6/physics/gta6_physics_edit/mod.rs similarity index 94% rename from src/state/gta6_physics_edit.rs rename to src/state/gta6/physics/gta6_physics_edit/mod.rs index e0069078b..331cb3df8 100644 --- a/src/state/gta6_physics_edit.rs +++ b/src/state/gta6/physics/gta6_physics_edit/mod.rs @@ -12,11 +12,11 @@ use or_io::gta6::headerless::{ write_polygon_flags, Bound, BoundGeometry, ChildBound, Fragment, Resource, }; -use super::document::Document; -use super::edit_history::Change; -use super::gta6_edit::EditSections; -use super::gta6_resource_save::EditedSave; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::document::Document; +use crate::state::edit_history::Change; +use crate::state::gta6_edit::EditSections; +use crate::state::gta6_resource_save::EditedSave; +use crate::state::{AppState, DocPayload, DocumentId}; /// What an edit of a GTA VI bound sets. #[derive(Debug, Clone, PartialEq)] @@ -56,7 +56,7 @@ pub(crate) enum FragmentEdit { } /// The bound a body is, or the one a drawable or a fragment embeds. -pub(super) fn bound_mut(payload: &mut DocPayload) -> Option<&mut Bound> { +pub(in crate::state) fn bound_mut(payload: &mut DocPayload) -> Option<&mut Bound> { let DocPayload::Gta6Drawable(resource) = payload else { return None; }; @@ -78,7 +78,10 @@ fn shape_mut(payload: &mut DocPayload, child: usize) -> Option<&mut ChildBound> .ok() } -pub(super) fn geometry_mut(payload: &mut DocPayload, child: usize) -> Option<&mut BoundGeometry> { +pub(in crate::state) fn geometry_mut( + payload: &mut DocPayload, + child: usize, +) -> Option<&mut BoundGeometry> { match shape_mut(payload, child)? { ChildBound::Geometry(g) => Some(g), _ => None, @@ -477,7 +480,7 @@ impl AppState { let path = self.document(doc).and_then(|d| d.path.clone()); if path .as_deref() - .and_then(super::gta6_navmesh::scanned_cell) + .and_then(crate::state::gta6_navmesh::scanned_cell) .is_none() { return Err( @@ -499,8 +502,8 @@ impl AppState { /// The GTA VI drawable row's `edited_sections`: the materials' edit, then a bound's or a /// fragment's values written over the body read again; `None` where it holds no edit. -pub(super) fn edited_save(document: &Document) -> Option> { - let save = super::gta6_edit::edited_save(document)?; +pub(in crate::state) fn edited_save(document: &Document) -> Option> { + let save = crate::state::gta6_edit::edited_save(document)?; let DocPayload::Gta6Drawable(resource) = &document.payload else { return Some(save); }; @@ -551,13 +554,13 @@ pub(super) fn edited_save(document: &Document) -> Option Option> { +pub(in crate::state) fn edited_cell(document: &Document) -> Option> { if !document.history.can_undo() { return None; } let path = document.path.as_deref()?; - let cell = super::gta6_navmesh::scanned_cell(path)?; - let (archive, offset) = super::rpf9_scan::scanned_body(path)?; + let cell = crate::state::gta6_navmesh::scanned_cell(path)?; + let (archive, offset) = crate::state::rpf9_scan::scanned_body(path)?; let DocPayload::Resource(or_io::Asset::NavMesh(mesh)) = &document.payload else { return None; }; @@ -565,13 +568,13 @@ pub(super) fn edited_cell(document: &Document) -> Option = Arc::new(move |_, sections| { - super::gta6_navmesh_delete::write_deletions(sections, &made, &others)?; + crate::state::gta6_navmesh_delete::write_deletions(sections, &made, &others)?; write_polygon_flags(&mut sections.virtual_section, &flags, keep) .map_err(|e| e.to_string())?; - super::gta6_navmesh_edit::write_cuts(&mut sections.virtual_section, &open) + crate::state::gta6_navmesh_edit::write_cuts(&mut sections.virtual_section, &open) }); Some(Ok(EditedSave::Body { archive: archive.to_path_buf(), @@ -580,9 +583,7 @@ pub(super) fn edited_cell(document: &Document) -> Option, keys: HashMap, } impl Built { /// The index of `dictionaries`, each body by its path with its textures' keys, of at most [`MOST_DICTIONARIES`]. - pub(super) fn of(dictionaries: impl IntoIterator)>) -> Self { + pub(in crate::state) fn of( + dictionaries: impl IntoIterator)>, + ) -> Self { let mut built = Self::default(); for (path, keys) in dictionaries.into_iter().take(MOST_DICTIONARIES) { let at = built.bodies.len() as u32; @@ -43,7 +45,7 @@ impl Built { } /// The body that holds `key`, by the path it opens under. - pub(super) fn body_of(&self, key: u64) -> Option<&PathBuf> { + pub(in crate::state) fn body_of(&self, key: u64) -> Option<&PathBuf> { (self.keys.get(&key)).and_then(|&at| self.bodies.get(at as usize)) } } @@ -58,7 +60,7 @@ fn holds_in(built: &Mutex>, key: u64) -> bool { type Opening = Arc)>>>; #[derive(Default)] -pub(super) struct DictionaryIndex { +pub(in crate::state) struct DictionaryIndex { /// The archives whose whole scans the index was built from, sorted. archives: Vec, built: Arc>>, @@ -67,19 +69,22 @@ pub(super) struct DictionaryIndex { /// The read in flight, if any. opening: Option, /// The dictionaries every archive of an install holds, as its scan's harvest found them. - pub(super) harvest: super::gta6_install_harvest::Harvest, + pub(in crate::state) harvest: crate::state::gta6_install_harvest::Harvest, } impl DictionaryIndex { /// Whether a dictionary of the index, or of an install's harvest, holds `key`. - pub(super) fn holds(&self, key: u64) -> bool { + pub(in crate::state) fn holds(&self, key: u64) -> bool { holds_in(&self.built, key) || holds_in(&self.harvest.built, key) } } /// The archive of each open scan of a whole GTA VI archive that ended whole, sorted, and the /// dictionary bodies their rows hold, by the paths they open under; the bodies only when `bodies`. -pub(super) fn whole_scans(documents: &[Document], bodies: bool) -> (Vec, Vec) { +pub(in crate::state) fn whole_scans( + documents: &[Document], + bodies: bool, +) -> (Vec, Vec) { let (mut archives, mut paths) = (Vec::new(), Vec::new()); for doc in documents { let DocPayload::Rpf9(scan) = &doc.payload else { @@ -113,7 +118,7 @@ pub(super) fn whole_scans(documents: &[Document], bodies: bool) -> (Vec /// The keys of the textures that read in each body of `bodies`, each body read and dropped in /// turn; a body that does not read holds none. `None` once `cancel` is set. -pub(super) fn index( +pub(in crate::state) fn index( bodies: Vec, cancel: &or_job::Cancel, progress: &or_job::Progress, @@ -149,7 +154,7 @@ pub(super) fn index( let Ok(dict) = read_dictionary(virtual_section, Some(physical)) else { continue; }; - super::ttpf_document::learn_names(&dict); + crate::state::ttpf_document::learn_names(&dict); let at = built.bodies.len() as u32; for (_, entry) in &dict.entries { if let Ok(Entry::Texture(t)) = entry { @@ -194,7 +199,7 @@ impl AppState { let harvest = harvest.unwrap_or_else(|p| p.into_inner()); let indexes = [open.as_ref(), harvest.as_ref()]; (self.texture_report.missing().into_iter()) - .filter_map(super::gta6_texture_index::key_of) + .filter_map(crate::state::gta6_texture_index::key_of) .filter_map(|key| indexes.into_iter().flatten().find_map(|i| i.body_of(key))) .cloned() .collect() @@ -240,7 +245,9 @@ impl AppState { self.texture_packs.dictionaries.opening = Some(Arc::clone(&opening)); std::thread::spawn(move || { let read = match scanned_body(&path) { - Some((archive, offset)) => super::rpf9_scan::read_body(&path, archive, offset), + Some((archive, offset)) => { + crate::state::rpf9_scan::read_body(&path, archive, offset) + } None => Err(path.display().to_string()), }; *opening.lock().unwrap_or_else(|p| p.into_inner()) = Some((path, read)); diff --git a/src/state/gta6_dictionary_write.rs b/src/state/gta6/textures/gta6_dictionary_write/mod.rs similarity index 91% rename from src/state/gta6_dictionary_write.rs rename to src/state/gta6/textures/gta6_dictionary_write/mod.rs index 393716dda..e2cf75316 100644 --- a/src/state/gta6_dictionary_write.rs +++ b/src/state/gta6/textures/gta6_dictionary_write/mod.rs @@ -9,13 +9,13 @@ use or_io::gta5::shared::PgDictionary; use or_io::gta6::headerless::{write_dictionary_textures, HeldTexture, TexturePlanError}; use or_io::gta6::slice_sources::slice_images; -use super::document::Document; -use super::gta6_edit::is_scanned_dictionary; -use super::texture_edit::TextureEdit; -use super::DocPayload; +use crate::state::document::Document; +use crate::state::gta6_edit::is_scanned_dictionary; +use crate::state::texture_edit::TextureEdit; +use crate::state::DocPayload; /// A texture of a scanned dictionary's document, as its save writes it. -pub(super) type Held = HeldTexture; +pub(in crate::state) type Held = HeldTexture; fn held_of(texture: &GrcTexture) -> Held { HeldTexture { @@ -46,7 +46,7 @@ fn said(e: TexturePlanError) -> String { /// Every texture of `dict`, as its save writes it. // ponytail: every texture's pixels are copied for the worker; only the edited ones if a dictionary's size makes it tell. -pub(super) fn held(dict: &PgDictionary) -> Vec { +pub(in crate::state) fn held(dict: &PgDictionary) -> Vec { dict.entries.iter().flatten().map(|t| held_of(t)).collect() } @@ -59,8 +59,8 @@ fn reshapeable<'a>( DocPayload::Resource(or_io::Asset::TextureDict(dict)) => dict.get(name), _ => None, }; - let slices = slices.map(|t| super::ttpf_document::scanned_slices(doc, t)); - let shown = super::ttpf_document::shown_scanned_slice(doc, name); + let slices = slices.map(|t| crate::state::ttpf_document::scanned_slices(doc, t)); + let shown = crate::state::ttpf_document::shown_scanned_slice(doc, name); let held = match &mut doc.payload { DocPayload::Resource(or_io::Asset::TextureDict(dict)) => dict.get_mut(name), _ => None, @@ -68,7 +68,7 @@ fn reshapeable<'a>( let (Some(texture), Some(slices)) = (held, slices) else { return Err(tr!("{name} is not in this dictionary", name = name)); }; - if texture.image_type == super::ttpf_document::VOLUME_IMAGE { + if texture.image_type == crate::state::ttpf_document::VOLUME_IMAGE { return Err(tr!( "{name} is a volume, so it keeps its size, format and mips: its levels lie across its z-slabs.", name = name @@ -149,7 +149,7 @@ fn reshaped( /// Texture `name` of the scanned dictionary `doc` re-encoded as `choice` with `options`' mips: the /// texture it was and what changed; `None` for any other document. -pub(super) fn reencode( +pub(in crate::state) fn reencode( doc: &mut Document, name: &str, choice: FormatChoice, @@ -171,7 +171,7 @@ pub(super) fn reencode( /// Texture `name` of the scanned dictionary `doc` from `image`: in its own shape where the image /// has its size and `choice` and `options` keep its format and mips, else given the image's size, /// that format, or its own for an automatic one, and those mips; `None` for any other document. -pub(super) fn import( +pub(in crate::state) fn import( doc: &mut Document, name: &str, image: &RgbaImage, @@ -192,7 +192,7 @@ pub(super) fn import( size && !format && !mips }); if same { - return super::gta6_edit::replace_scanned_texture(doc, name, image, choice, options); + return crate::state::gta6_edit::replace_scanned_texture(doc, name, image, choice, options); } Some(reshapeable(doc, name).and_then(|(texture, slices, shown)| { let format = match choice { @@ -213,7 +213,7 @@ pub(super) fn import( /// Whether a scanned GTA VI dictionary takes `texture` as a new one: a name it stores in lower /// case, and a format and levels its save tiles, as a replace checks when it is made. -pub(super) fn can_add(texture: &GrcTexture) -> Result<(), String> { +pub(in crate::state) fn can_add(texture: &GrcTexture) -> Result<(), String> { let name = &texture.name; if !name.is_ascii() || name.contains('\0') { return Err(tr!( @@ -226,10 +226,9 @@ pub(super) fn can_add(texture: &GrcTexture) -> Result<(), String> { /// `held` written over the scanned dictionary `sections` hold: in place where every texture keeps /// its shape and none is added or removed, else both sections planned anew from the textures. -pub(super) fn write(sections: &mut Rpf9Sections, held: &[Held]) -> Result<(), String> { +pub(in crate::state) fn write(sections: &mut Rpf9Sections, held: &[Held]) -> Result<(), String> { write_dictionary_textures(sections, held).map_err(said) } #[cfg(test)] -#[path = "gta6_dictionary_write_tests.rs"] mod tests; diff --git a/src/state/gta6_dictionary_write_tests.rs b/src/state/gta6/textures/gta6_dictionary_write/tests.rs similarity index 100% rename from src/state/gta6_dictionary_write_tests.rs rename to src/state/gta6/textures/gta6_dictionary_write/tests.rs diff --git a/src/state/gta6_embedded_edit.rs b/src/state/gta6/textures/gta6_embedded_edit/mod.rs similarity index 93% rename from src/state/gta6_embedded_edit.rs rename to src/state/gta6/textures/gta6_embedded_edit/mod.rs index bf6cc22b4..382e66d3b 100644 --- a/src/state/gta6_embedded_edit.rs +++ b/src/state/gta6/textures/gta6_embedded_edit/mod.rs @@ -16,17 +16,17 @@ use or_io::gta6::headerless::{ }; use or_io::gta6::Texture; -use super::document::Document; -use super::edit_history::{Change, Swap}; -use super::gta6_edit::EditSections; -use super::gta6_resource::{drawable_of, texture_name}; -use super::gta6_resource_save::EditedSave; -use super::texture_edit::TextureEdit; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::document::Document; +use crate::state::edit_history::{Change, Swap}; +use crate::state::gta6_edit::EditSections; +use crate::state::gta6_resource::{drawable_of, texture_name}; +use crate::state::gta6_resource_save::EditedSave; +use crate::state::texture_edit::TextureEdit; +use crate::state::{AppState, DocPayload, DocumentId}; /// What a document holds in place of the texture a body embeds under a key. #[derive(Debug, Clone, PartialEq, Eq)] -pub(super) enum Held { +pub(in crate::state) enum Held { /// Pixels in any shape, of the texture the body embeds or of one it does not. Texture(Texture), /// None: the texture was unembedded. @@ -43,18 +43,18 @@ fn edits() -> MutexGuard<'static, BTreeMap>> { } /// Forget the edits of the body at `path`, which opens anew with none. -pub(super) fn forget(path: &Path) { +pub(in crate::state) fn forget(path: &Path) { edits().remove(path); } /// What the document holds for the embedded texture `key` of the body at `path`, if it edited it. -pub(super) fn edited(path: &Path, key: u64) -> Option { +pub(in crate::state) fn edited(path: &Path, key: u64) -> Option { edits().get(path)?.get(&key).cloned() } /// The pixels the embedded texture `key` of the body at `path` was replaced with, if it was. #[cfg(test)] -pub(super) fn replaced(path: &Path, key: u64) -> Option> { +pub(in crate::state) fn replaced(path: &Path, key: u64) -> Option> { match edited(path, key)? { Held::Texture(texture) => Some(texture.pixels), Held::Removed => None, @@ -89,7 +89,7 @@ fn shown(path: &Path, key: u64) -> Option<(Option, bool)> { Some(Held::Removed) => return None, None => {} } - let head = super::gta6_head::head_of(path)?; + let head = crate::state::gta6_head::head_of(path)?; let found = ((*head).as_ref().ok()?.textures.iter()) .flatten() .find(|t| t.key == key)?; @@ -100,7 +100,7 @@ fn shown(path: &Path, key: u64) -> Option<(Option, bool)> { /// The keys the document shows embedded in the body at `path`. fn shown_keys(path: &Path) -> BTreeSet { - let head = super::gta6_head::head_of(path); + let head = crate::state::gta6_head::head_of(path); let read = (head.iter()).flat_map(|h| (**h).as_ref().ok().map(|h| &h.textures)); let mut keys: BTreeSet = read.flatten().flatten().map(|t| t.key).collect(); for (key, held) in edits().get(path).into_iter().flatten() { @@ -126,7 +126,7 @@ fn is_shown(path: &Path, key: u64) -> bool { Some(Held::Removed) => return false, None => {} } - super::gta6_head::head_of(path).is_some_and(|head| { + crate::state::gta6_head::head_of(path).is_some_and(|head| { (*head) .as_ref() .is_ok_and(|h| h.textures.iter().flatten().any(|t| t.key == key)) @@ -134,7 +134,7 @@ fn is_shown(path: &Path, key: u64) -> bool { } /// Whether the drawable of `doc` embeds the texture `name` it binds. -pub(super) fn embeds(state: &AppState, doc: DocumentId, name: &str) -> bool { +pub(in crate::state) fn embeds(state: &AppState, doc: DocumentId, name: &str) -> bool { embedded_key(state, doc, name).is_some() } @@ -176,8 +176,8 @@ fn reshaped( if (image.width, image.height) == (read.width, read.height) && (target, mips) == (own, read.levels) { - let mut texture = super::ttpf_document::grc(name.to_string(), read.clone())?; - super::gta6_edit::replaced(&mut texture, image, format, options)?; + let mut texture = crate::state::ttpf_document::grc(name.to_string(), read.clone())?; + crate::state::gta6_edit::replaced(&mut texture, image, format, options)?; let pixels = texture.backing_store; return Ok(Texture { pixels, ..read }); } @@ -261,7 +261,7 @@ impl AppState { /// The texture `name` that the drawable `doc` embeds replaced from the image at `image`, in its /// own shape or the one `format` and `options` ask, as a step of undo; `None` where it embeds /// none of that name. - pub(super) fn replace_embedded_texture( + pub(in crate::state) fn replace_embedded_texture( &mut self, doc: DocumentId, name: &str, @@ -437,7 +437,7 @@ fn write_held( } None => { let model = planned(*key, texture)?; - let word = (super::gta6_edit::named_word(*key)) + let word = (crate::state::gta6_edit::named_word(*key)) .or_else(|| key_word(§ions.virtual_section, *key)) .ok_or_else(|| { tr!( @@ -454,8 +454,8 @@ fn write_held( /// The GTA VI drawable row's `edited_sections` before its glTF imports: its materials, physics and /// bones, then each embedded texture replaced, re-planned, embedded or unembedded. -pub(super) fn edited_save(document: &Document) -> Option> { - let save = super::gta6_bone_edit::edited_save(document)?; +pub(in crate::state) fn edited_save(document: &Document) -> Option> { + let save = crate::state::gta6_bone_edit::edited_save(document)?; let DocPayload::Gta6Drawable(resource) = &document.payload else { return Some(save); }; @@ -491,5 +491,4 @@ pub(super) fn edited_save(document: &Document) -> Option t.backing_store.clone(), _ => panic!("the embedded texture is drawn"), } @@ -195,7 +195,7 @@ fn an_embedded_texture_is_replaced_drawn_undone_and_saved_into_its_own_tiles() { edit.expect("a GTA VI drawable").expect("unembedded"); assert!(!embeds(&state, doc, &name)); let payload = &state.document(doc).expect("open").payload; - assert!(super::super::gta6_head::texture_named(payload, None, &name).is_none()); + assert!(crate::state::gta6_head::texture_named(payload, None, &name).is_none()); let unembedded = saved(&mut state); let head = read_drawable_head( &unembedded.virtual_section, @@ -210,6 +210,6 @@ fn an_embedded_texture_is_replaced_drawn_undone_and_saved_into_its_own_tiles() { assert_eq!(replaced(&path, key), Some(smaller)); // The body opened anew, as after a close that did not save, holds none of them. - super::super::rpf9_scan::read_body(&path, &path, 0).expect("it opens again"); + crate::state::rpf9_scan::read_body(&path, &path, 0).expect("it opens again"); assert_eq!(replaced(&path, key), None); } diff --git a/src/state/gta6_texture_index.rs b/src/state/gta6/textures/gta6_texture_index.rs similarity index 94% rename from src/state/gta6_texture_index.rs rename to src/state/gta6/textures/gta6_texture_index.rs index 1bbc34acf..8ab7eca86 100644 --- a/src/state/gta6_texture_index.rs +++ b/src/state/gta6/textures/gta6_texture_index.rs @@ -12,9 +12,9 @@ use or_io::container::rpf::{seal_rpf9_scan, unseal_rpf9_scan}; use or_io::gta6::hash::name_hash64; use or_io::gta6::TexturePack; -use super::gta6_texture_naming::{NamingEnded, TextureNaming}; -use super::rpf9_kept::word; -use super::{AppState, DocPayload, Document, DocumentId, DocumentKind}; +use crate::state::gta6_texture_naming::{NamingEnded, TextureNaming}; +use crate::state::rpf9_kept::word; +use crate::state::{AppState, DocPayload, Document, DocumentId, DocumentKind}; /// The version of what this file keeps of an index: a change to it takes another. const VERSION: u64 = 2; @@ -44,7 +44,7 @@ impl Kept { let mut of = VERSION.to_le_bytes().to_vec(); put(&mut of, path.as_bytes()); let name = name_hash64(path.as_bytes()); - let folder = super::prefs::config_root()?.join("gta6_texture_indexes"); + let folder = crate::state::prefs::config_root()?.join("gta6_texture_indexes"); let file = folder.join(format!("{name:016x}.index")); Some(Self { file, of }) } @@ -147,13 +147,13 @@ impl Kept { } /// `bytes` after their length, as a kept index states a path, a pack's keys and their format codes. -pub(super) fn put(plain: &mut Vec, bytes: &[u8]) { +pub(in crate::state) fn put(plain: &mut Vec, bytes: &[u8]) { plain.extend((bytes.len() as u64).to_le_bytes()); plain.extend(bytes); } /// The bytes the next length in `bytes` states, which moves past them. -pub(super) fn stated<'a>(bytes: &mut &'a [u8]) -> io::Result<&'a [u8]> { +pub(in crate::state) fn stated<'a>(bytes: &mut &'a [u8]) -> io::Result<&'a [u8]> { let len = usize::try_from(word(bytes)?).ok(); let (stated, rest) = (len.and_then(|len| bytes.split_at_checked(len))).ok_or(io::ErrorKind::UnexpectedEof)?; @@ -162,7 +162,7 @@ pub(super) fn stated<'a>(bytes: &mut &'a [u8]) -> io::Result<&'a [u8]> { } /// The size of the file at `path` and its modification time, in nanoseconds. -pub(super) fn stat(path: &Path) -> Option<(u64, u64)> { +pub(in crate::state) fn stat(path: &Path) -> Option<(u64, u64)> { let meta = std::fs::metadata(path).ok()?; let modified = meta.modified().ok()?.duration_since(UNIX_EPOCH).ok()?; Some((meta.len(), modified.as_nanos() as u64)) @@ -176,7 +176,10 @@ struct Opening { } /// A pack a worker opened, by its path. -type Opened = (PathBuf, Result); +type Opened = ( + PathBuf, + Result, +); /// The stack a pack's header is read on. const OPENING_STACK: usize = 8 << 20; @@ -192,7 +195,7 @@ struct Index { } #[derive(Default)] -pub(super) struct PackIndex { +pub(in crate::state) struct PackIndex { root: Option, built: Arc>>, /// The folder each drawable asked for is served by, found once, and the packs opened or tried, each once. @@ -203,7 +206,7 @@ pub(super) struct PackIndex { /// Set where documents come and go by the thousand over one folder: the index outlives each. kept_across_documents: bool, /// The dictionaries the open archives' scans found, by their textures' keys. - pub(super) dictionaries: super::gta6_dictionary_index::DictionaryIndex, + pub(in crate::state) dictionaries: crate::state::gta6_dictionary_index::DictionaryIndex, } impl PackIndex { @@ -216,7 +219,7 @@ impl PackIndex { } /// The folder whose packs serve `doc`: the install or folder open around its file, else the folder its file, or its archive, is in. -pub(super) fn root_of(state: &AppState, doc: &Document) -> Option { +pub(in crate::state) fn root_of(state: &AppState, doc: &Document) -> Option { let file = doc.path.as_deref()?; let open = (state.documents.iter()) .filter(|d| matches!(d.kind(), DocumentKind::GameRoot | DocumentKind::Folder)) @@ -301,7 +304,7 @@ fn index( } /// The key a texture name a GTA VI drawable states stands for: `hash_` and the key, or a name's hash. -pub(super) fn key_of(name: &str) -> Option { +pub(in crate::state) fn key_of(name: &str) -> Option { match name.strip_prefix("hash_") { Some(hex) => u64::from_str_radix(hex, 16).ok(), None => Some(name_hash64(name.as_bytes())), @@ -310,7 +313,7 @@ pub(super) fn key_of(name: &str) -> Option { /// A worker's work that gives every key the packs under `root` hold, read as the pack index reads them and kept as it keeps them; `None` once cancelled. // ⚠ Where the index is kept is found here, on the caller's thread: a test's configuration folder is its own thread's. -pub(super) fn pack_keys( +pub(in crate::state) fn pack_keys( root: &Path, ) -> impl FnOnce(&or_job::Cancel, &or_job::Progress) -> Option> + Send + 'static { let (root, kept) = (root.to_path_buf(), Kept::of(root)); @@ -328,11 +331,11 @@ const TEXTURE_ARCHIVE: &str = "textures.rpf"; const DICTIONARY_HEAD: usize = 1 << 20; /// The texture archive under a folder, and the offset of the dictionary body that holds each key. -pub(super) type DictionaryPlaces = (PathBuf, HashMap); +pub(in crate::state) type DictionaryPlaces = (PathBuf, HashMap); /// The packs of a folder, the pack each key is in, the format code each key's texture states, and /// the dictionaries of its texture archive that hold a key no pack holds. -pub(super) type PackPlaces = ( +pub(in crate::state) type PackPlaces = ( Vec, HashMap, HashMap, @@ -341,7 +344,7 @@ pub(super) type PackPlaces = ( /// A worker's work that gives the packs under `root` and, for each key, which of them holds it and the format code it states, read as the pack index reads them and kept as it keeps them, then the dictionaries of the texture archive; `None` once cancelled. // ⚠ Where the index is kept is found here, on the caller's thread, as [`pack_keys`] finds it. -pub(super) fn pack_places( +pub(in crate::state) fn pack_places( root: &Path, ) -> impl FnOnce(&or_job::Cancel, &or_job::Progress) -> Option + Send + 'static { let (root, kept) = (root.to_path_buf(), Kept::of(root)); @@ -435,22 +438,24 @@ fn unheld_material_keys(state: &AppState, doc: &Document) -> Vec { return Vec::new(); }; // A dictionary's drawable is picked only by a selection, so every one of them is walked. - let drawables = (super::gta6_resource::drawable_of(resource, None).into_iter()) - .chain(super::gta6_resource::dictionary_drawables(resource).map(|(_, d)| d)); + let drawables = (crate::state::gta6_resource::drawable_of(resource, None).into_iter()) + .chain(crate::state::gta6_resource::dictionary_drawables(resource).map(|(_, d)| d)); let held = |key: u64| { let name = format!("hash_{key:016X}"); - (state.documents.iter()).any(|d| super::ttpf_document::holds(Some(doc), &d.payload, &name)) + (state.documents.iter()) + .any(|d| crate::state::ttpf_document::holds(Some(doc), &d.payload, &name)) }; // The parts a run draws beside the drawable bind maps too, and so do the states a ped's // parts are worn in. let beside = crate::render::gta6_meshlets::beside(); let beside = beside.iter().flat_map(|parts| parts.iter()); - let beside = beside.filter_map(|part| super::gta6_resource::drawable_of(&part.resource, None)); + let beside = + beside.filter_map(|part| crate::state::gta6_resource::drawable_of(&part.resource, None)); let shaders = drawables .chain(beside) .flat_map(|drawable| &drawable.shaders); let keys = shaders.flat_map(|s| s.texture_keys.iter().flatten().copied()); - let keys = keys.chain(super::gta6_shaders::ped_assets::dressed_keys()); + let keys = keys.chain(crate::state::gta6_shaders::ped_assets::dressed_keys()); keys.filter(|key| !held(*key)).collect() } @@ -534,8 +539,8 @@ impl AppState { .collect(), false => Vec::new(), }; - missing.extend(super::gta6_shaders::layer_index::tile_keys(self)); - missing.extend(super::gta6_shaders::terrain_tile::texture_keys(self)); + missing.extend(crate::state::gta6_shaders::layer_index::tile_keys(self)); + missing.extend(crate::state::gta6_shaders::terrain_tile::texture_keys(self)); missing.extend(unheld_material_keys(self, doc)); if missing.is_empty() || !matches!(doc.payload, DocPayload::Gta6Drawable(_)) { return; @@ -597,7 +602,7 @@ impl AppState { return None; } } - let found = super::texture_resolution::probe(self, None, None, name).found; + let found = crate::state::texture_resolution::probe(self, None, None, name).found; found.is_none().then(|| root.clone()) } @@ -611,7 +616,7 @@ impl AppState { } /// Forget the index once `path`, which the app wrote, moved or removed, is under its folder. - pub(super) fn texture_packs_changed(&mut self, path: &Path) { + pub(in crate::state) fn texture_packs_changed(&mut self, path: &Path) { if (self.texture_packs.root.as_deref()).is_some_and(|root| path.starts_with(root)) { self.texture_packs.forget(); } @@ -657,7 +662,7 @@ fn open_on_a_worker(opening: &mut Opening, path: PathBuf) { let opened = Arc::clone(&opening.opened); opening.asked.push(path.clone()); let open = move || { - let ttpf = super::ttpf_document::TtpfDocument::open(&path); + let ttpf = crate::state::ttpf_document::TtpfDocument::open(&path); (opened.lock().unwrap_or_else(|p| p.into_inner())).push((path, ttpf)); }; let task = Arc::new(Mutex::new(Some(open))); diff --git a/src/state/gta6_texture_names_file.rs b/src/state/gta6/textures/gta6_texture_names_file.rs similarity index 93% rename from src/state/gta6_texture_names_file.rs rename to src/state/gta6/textures/gta6_texture_names_file.rs index d94ec9170..2f9a576ae 100644 --- a/src/state/gta6_texture_names_file.rs +++ b/src/state/gta6/textures/gta6_texture_names_file.rs @@ -5,8 +5,8 @@ use std::collections::HashSet; use std::io::Read; use std::path::Path; -use super::gta6_texture_naming::{NamingEnded, TextureNaming}; -use super::{AppState, DocPayload}; +use crate::state::gta6_texture_naming::{NamingEnded, TextureNaming}; +use crate::state::{AppState, DocPayload}; /// The most bytes of a names file read. const MOST_BYTES: u64 = 256 << 20; @@ -64,7 +64,7 @@ impl AppState { return NamingEnded::Stopped; } progress.reached(done as u64, lines.len() as u64); - named += super::ttpf_document::learn_rule_names(line, &keys); + named += crate::state::ttpf_document::learn_rule_names(line, &keys); } NamingEnded::Loaded(named) }); diff --git a/src/state/gta6_texture_naming.rs b/src/state/gta6/textures/gta6_texture_naming.rs similarity index 92% rename from src/state/gta6_texture_naming.rs rename to src/state/gta6/textures/gta6_texture_naming.rs index 77ad53c97..4f409b36d 100644 --- a/src/state/gta6_texture_naming.rs +++ b/src/state/gta6/textures/gta6_texture_naming.rs @@ -7,12 +7,12 @@ use std::sync::{Arc, Mutex}; use or_job::{Cancel, Progress}; -use super::jobs::{JobKind, Outcome, RunningJob, Then}; -use super::AppState; +use crate::state::jobs::{JobKind, Outcome, RunningJob, Then}; +use crate::state::AppState; /// How a naming run ended. #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub(super) enum NamingEnded { +pub(in crate::state) enum NamingEnded { /// How many keys it named. Named(usize), /// How many texture packs it indexed by their keys, and how many of them it read, the rest being as kept. @@ -35,7 +35,7 @@ pub(super) enum NamingEnded { Failed(&'static str), } -pub(super) struct TextureNaming { +pub(in crate::state) struct TextureNaming { doing: String, cancel: Cancel, progress: Progress, @@ -44,7 +44,7 @@ pub(super) struct TextureNaming { impl TextureNaming { /// Learn the names the rules give from `stems` for any of `keys`, on a worker. - pub(super) fn start(stems: Vec, keys: HashSet) -> Self { + pub(in crate::state) fn start(stems: Vec, keys: HashSet) -> Self { let doing = tr!("Naming GTA VI textures from their drawables' names").to_string(); Self::run(doing, move |cancel, progress| { let mut named = 0; @@ -53,14 +53,14 @@ impl TextureNaming { return NamingEnded::Stopped; } progress.reached(done as u64, stems.len() as u64); - named += super::ttpf_document::learn_rule_names(stem, &keys); + named += crate::state::ttpf_document::learn_rule_names(stem, &keys); } NamingEnded::Named(named) }) } /// Run `work` on a worker as a naming run, which the job list says is `doing`. - pub(super) fn run( + pub(in crate::state) fn run( doing: String, work: impl FnOnce(&Cancel, &Progress) -> NamingEnded + Send + 'static, ) -> Self { @@ -112,17 +112,17 @@ impl Drop for TextureNaming { impl AppState { /// The naming runs still running, as the job list draws them. - pub(super) fn texture_naming_jobs(&self) -> impl Iterator + '_ { + pub(in crate::state) fn texture_naming_jobs(&self) -> impl Iterator + '_ { self.texture_naming.iter().filter_map(TextureNaming::job) } /// Ask every naming run to stop; each says it stopped once its worker sees the stop. - pub(super) fn stop_texture_naming(&self) { + pub(in crate::state) fn stop_texture_naming(&self) { self.texture_naming.iter().for_each(|n| n.cancel.set()); } /// Say in the job list how each naming run that ended went, and drop it. - pub(super) fn poll_texture_naming(&mut self) { + pub(in crate::state) fn poll_texture_naming(&mut self) { let mut ended = Vec::new(); self.texture_naming.retain(|n| match n.ended() { Some(e) => { diff --git a/src/state/gta6_textures.rs b/src/state/gta6/textures/gta6_textures.rs similarity index 81% rename from src/state/gta6_textures.rs rename to src/state/gta6/textures/gta6_textures.rs index 4cc66ee12..c1a6d2400 100644 --- a/src/state/gta6_textures.rs +++ b/src/state/gta6/textures/gta6_textures.rs @@ -8,12 +8,14 @@ use std::path::Path; use or_io::authoring::{FormatChoice, TextureBuildOptions}; use or_io::codec::texture::GrcTextureFormat; -use super::document::DocPayload; -use super::gta6_resource::{drawable_of, texture_name}; -use super::selection::{DictPart, SelectionKey}; -use super::selection_lookup::name_hash; -use super::textures::{DocumentTexture, Texture, TextureListing, TextureResolution, TextureSource}; -use super::toasts::ToastAction; +use crate::state::document::DocPayload; +use crate::state::gta6_resource::{drawable_of, texture_name}; +use crate::state::selection::{DictPart, SelectionKey}; +use crate::state::selection_lookup::name_hash; +use crate::state::textures::{ + DocumentTexture, Texture, TextureListing, TextureResolution, TextureSource, +}; +use crate::state::toasts::ToastAction; /// What a selection that is no texture of the drawable says. const PICK_A_TEXTURE: &str = "Select one of its textures, under Textures"; @@ -71,8 +73,8 @@ pub(crate) fn list(payload: &DocPayload, selection: Option) -> Tex /// hold given the size and format the directory of an open pack states for its key, else those of /// the texture it resolves to in another open document. pub fn sized_for_gta6( - state: &super::AppState, - doc: super::DocumentId, + state: &crate::state::AppState, + doc: crate::state::DocumentId, mut listing: TextureListing, ) -> TextureListing { let drawable = state.document(doc).map(|d| &d.payload); @@ -85,7 +87,11 @@ pub fn sized_for_gta6( // ⚠ Asked every frame by the Outline and the Gallery, and a resolve reads what it finds: the // sizes are found again only when the names asked or an open document change. let mut hasher = std::hash::DefaultHasher::new(); - (doc, super::gta6_resource::drawable_lines_stamp(state)).hash(&mut hasher); + ( + doc, + crate::state::gta6_resource::drawable_lines_stamp(state), + ) + .hash(&mut hasher); // Where each open document is, which tells one session's documents from another's. (state.documents.iter()).for_each(|d| std::ptr::from_ref(&d.payload).hash(&mut hasher)); textures @@ -106,7 +112,9 @@ pub fn sized_for_gta6( .format() .map_or(GrcTextureFormat::None, |f| f.format()); // Packs first: their directory states the size without reading the texture from disk. - } else if let Some(found) = super::texture_resolution::resolve(state, None, None, &t.name) { + } else if let Some(found) = + crate::state::texture_resolution::resolve(state, None, None, &t.name) + { let texture = found.texture; (t.width, t.height) = (texture.width().into(), texture.height().into()); t.format = texture.format(); @@ -125,7 +133,7 @@ type Sized = Option<(u64, Vec<(u32, u32, GrcTextureFormat)>)>; static SIZED: std::sync::Mutex = std::sync::Mutex::new(None); /// The directory entry an open pack holds for texture `name`, a GTA VI drawable's key by the name it is known by. -pub fn open_pack_entry(state: &super::AppState, name: &str) -> Option { +pub fn open_pack_entry(state: &crate::state::AppState, name: &str) -> Option { (state.documents.iter()) .find_map(|d| match &d.payload { DocPayload::Ttpf(pack) => pack.index_of(name).and_then(|i| pack.pack.entries.get(i)), @@ -161,7 +169,7 @@ pub(crate) fn at<'p>(payload: &'p DocPayload, _: TextureSource, name: &str) -> O let texture = dict.entries.iter().find_map(|(_, entry)| match entry { Ok(Entry::Texture(t)) if t.name.eq_ignore_ascii_case(name) => { let pixels = t.texture.as_ref().ok()?.clone(); - super::ttpf_document::grc(t.name.clone(), pixels).ok() + crate::state::ttpf_document::grc(t.name.clone(), pixels).ok() } _ => None, })?; @@ -171,28 +179,28 @@ pub(crate) fn at<'p>(payload: &'p DocPayload, _: TextureSource, name: &str) -> O /// The texture `name` that a key of `doc`, a scanned GTA VI drawable, resolves to in another /// document, as the model view binds it; `None` for any other document. pub fn resolved_for_gta6( - state: &super::AppState, - doc: super::DocumentId, + state: &crate::state::AppState, + doc: crate::state::DocumentId, selection: Option, name: &str, ) -> Option> { if !matches!(state.document(doc)?.payload, DocPayload::Gta6Drawable(_)) { return None; } - let resolved = super::texture_resolution::resolve(state, None, selection, name)?; + let resolved = crate::state::texture_resolution::resolve(state, None, selection, name)?; Some(resolved.texture.into_owned()) } /// Said of a texture a drawable binds by a key that no open document holds. -pub(super) const UNRESOLVED: &str = tr_key!( +pub(in crate::state) const UNRESOLVED: &str = tr_key!( "This texture is unresolved: no open texture pack and no dictionary the app has read holds it." ); -impl super::AppState { +impl crate::state::AppState { /// `listing` of `doc`, a scanned GTA VI drawable, without the textures no pack of its install holds: there is no picture to show for one. pub fn without_unheld_textures( &self, - doc: super::DocumentId, + doc: crate::state::DocumentId, mut listing: TextureListing, ) -> TextureListing { if let TextureListing::Textures { textures, .. } = &mut listing { @@ -205,25 +213,25 @@ impl super::AppState { /// The open document that holds the texture `name` a key of the drawable `doc` resolves to; `Err` says none does. pub fn bound_texture_holder( &self, - doc: super::DocumentId, + doc: crate::state::DocumentId, name: &str, - ) -> Result { - let from = super::preview_scene::MeshSource { + ) -> Result { + let from = crate::state::preview_scene::MeshSource { document: doc, entry: None, }; - let found = super::texture_resolution::probe(self, Some(from), None, name).found; + let found = crate::state::texture_resolution::probe(self, Some(from), None, name).found; (found.map(|origin| origin.document)).ok_or(crate::i18n::tr(UNRESOLVED)) } /// The document that takes a replacement of that texture; `Err` says why none does: no document holds it, or one no view may change does. pub fn bound_texture_pack( &self, - doc: super::DocumentId, + doc: crate::state::DocumentId, name: &str, - ) -> Result { + ) -> Result { // A texture the drawable's own shader group embeds is replaced in the drawable. - if super::gta6_embedded_edit::embeds(self, doc, name) { + if crate::state::gta6_embedded_edit::embeds(self, doc, name) { return Ok(doc); } let holder = self.bound_texture_holder(doc, name)?; @@ -232,7 +240,7 @@ impl super::AppState { }; // A scanned dictionary's texture is replaced as its own tab replaces it, and saved as that tab saves. match held.read_only { - Some(_) if super::gta6_edit::is_scanned_dictionary(held) => Ok(holder), + Some(_) if crate::state::gta6_edit::is_scanned_dictionary(held) => Ok(holder), Some(why) => Err(crate::i18n::tr(why)), None => Ok(holder), } @@ -241,7 +249,7 @@ impl super::AppState { /// Replace that texture from the image at `image`, in the pack that holds it, and offer that pack's save: the drawable on screen saves nothing. pub fn replace_bound_texture( &mut self, - doc: super::DocumentId, + doc: crate::state::DocumentId, name: &str, image: &Path, format: FormatChoice, @@ -268,7 +276,7 @@ impl super::AppState { let file = held.map_or_else(String::new, |held| held.file_name()); // ⚠ A body read out of an archive is never saved over it: Save As in its tab writes a file of its own. let in_archive = (held.and_then(|d| d.path.as_deref())).is_some_and(|path| { - super::rpf9_scan::scanned_body(path).is_some_and(|(at, _)| at != path) + crate::state::rpf9_scan::scanned_body(path).is_some_and(|(at, _)| at != path) }); if in_archive { self.show_info_toast(tr!( @@ -288,7 +296,7 @@ impl super::AppState { } /// Save the pack `pack` as Save does the document in front, which stays in front. - pub(super) fn save_pack(&mut self, pack: super::DocumentId) { + pub(in crate::state) fn save_pack(&mut self, pack: crate::state::DocumentId) { // ⚠ Save writes the active document and asks the edit gate for it, so the pack is that while its save starts. let in_front = self.active_document.replace(pack); self.save_active_document(); @@ -299,28 +307,32 @@ impl super::AppState { /// Returns `Ok(true)` when written, `Ok(false)` when refused by the gate (already reported), or `Err` on failure. pub fn export_texture_to( &mut self, - texture: &super::textures::Texture<'_>, + texture: &crate::state::textures::Texture<'_>, level: u32, path: &Path, ) -> Result { match self.gate_permits(Some(path)) { - super::GateOutcome::Proceed => {} - super::GateOutcome::Refused => return Ok(false), - super::GateOutcome::Confirm(_) => { - return Err(super::gta6_modding::mod_package::in_game_folder(path)); + crate::state::GateOutcome::Proceed => {} + crate::state::GateOutcome::Refused => return Ok(false), + crate::state::GateOutcome::Confirm(_) => { + return Err(crate::state::gta6_modding::mod_package::in_game_folder( + path, + )); } } - super::textures::export_texture(texture, level, path)?; + crate::state::textures::export_texture(texture, level, path)?; Ok(true) } /// Write that texture to `path`: every mip for a `.dds`, else its top mip as a PNG. - pub fn export_bound_texture(&mut self, doc: super::DocumentId, name: &str, path: &Path) { + pub fn export_bound_texture(&mut self, doc: crate::state::DocumentId, name: &str, path: &Path) { match self.gate_permits(Some(path)) { - super::GateOutcome::Proceed => {} - super::GateOutcome::Refused => return, - super::GateOutcome::Confirm(_) => { - self.show_error_toast(super::gta6_modding::mod_package::in_game_folder(path)); + crate::state::GateOutcome::Proceed => {} + crate::state::GateOutcome::Refused => return, + crate::state::GateOutcome::Confirm(_) => { + self.show_error_toast(crate::state::gta6_modding::mod_package::in_game_folder( + path, + )); return; } } @@ -331,7 +343,7 @@ impl super::AppState { name = name ) }) - .and_then(|texture| super::textures::export_texture(&texture, 0, path)); + .and_then(|texture| crate::state::textures::export_texture(&texture, 0, path)); match written { Ok(()) => self.show_toast(tr!("Wrote {path}", path = path.display())), Err(why) => self.show_error_toast(why), diff --git a/src/state/gta6/textures/mod.rs b/src/state/gta6/textures/mod.rs new file mode 100644 index 000000000..73649bf77 --- /dev/null +++ b/src/state/gta6/textures/mod.rs @@ -0,0 +1,7 @@ +pub(crate) mod gta6_dictionary_index; +pub(crate) mod gta6_dictionary_write; +pub(crate) mod gta6_embedded_edit; +pub(crate) mod gta6_texture_index; +pub(crate) mod gta6_texture_names_file; +pub(crate) mod gta6_texture_naming; +pub(crate) mod gta6_textures; diff --git a/src/state/gta6_map_entity.rs b/src/state/gta6/world/gta6_map/entity.rs similarity index 100% rename from src/state/gta6_map_entity.rs rename to src/state/gta6/world/gta6_map/entity.rs diff --git a/src/state/gta6_map_links.rs b/src/state/gta6/world/gta6_map/links/mod.rs similarity index 99% rename from src/state/gta6_map_links.rs rename to src/state/gta6/world/gta6_map/links/mod.rs index ee1e6859a..bcf042f4a 100644 --- a/src/state/gta6_map_links.rs +++ b/src/state/gta6/world/gta6_map/links/mod.rs @@ -623,5 +623,4 @@ impl AppState { } #[cfg(test)] -#[path = "gta6_map_links_tests.rs"] mod tests; diff --git a/src/state/gta6_map_links_tests.rs b/src/state/gta6/world/gta6_map/links/tests.rs similarity index 100% rename from src/state/gta6_map_links_tests.rs rename to src/state/gta6/world/gta6_map/links/tests.rs diff --git a/src/state/gta6_map.rs b/src/state/gta6/world/gta6_map/mod.rs similarity index 96% rename from src/state/gta6_map.rs rename to src/state/gta6/world/gta6_map/mod.rs index b8c21b44f..680988207 100644 --- a/src/state/gta6_map.rs +++ b/src/state/gta6/world/gta6_map/mod.rs @@ -16,11 +16,11 @@ use or_job::{Cancel, Progress}; use or_maps::{Name, Placed, Scene}; use or_world::gizmo::Obb; -use super::jobs::{file_name, JobKind, Outcome, RunningJob, Then}; -use super::rpf9_scan::{scanned_body, view_of, Row, View}; -use super::workbench::{Pick, PickKind}; -use super::{AppState, DocPayload}; +use crate::state::jobs::{file_name, JobKind, Outcome, RunningJob, Then}; +use crate::state::rpf9_scan::{scanned_body, view_of, Row, View}; +use crate::state::workbench::{Pick, PickKind}; use crate::state::Workspace; +use crate::state::{AppState, DocPayload}; /// The bytes a body is read to: more than any map types body was measured to hold. const BODY_LIMIT: u64 = 256 << 20; @@ -62,7 +62,7 @@ fn models() -> MutexGuard<'static, ModelsBy> { static KNOWN: AtomicU64 = AtomicU64::new(0); /// Keep what the map reader reads of the scanned body at `path`, when its root is a map class. -pub(super) fn keep(path: &Path, virtual_section: &[u8], physical: &[u8]) -> bool { +pub(in crate::state) fn keep(path: &Path, virtual_section: &[u8], physical: &[u8]) -> bool { let Some(root) = map::root_type(virtual_section) else { return false; }; @@ -277,7 +277,7 @@ impl AppState { } /// Place the active document's map again when it, or an archetype it may name, changed since. - pub(super) fn refresh_scanned_map(&mut self) { + pub(in crate::state) fn refresh_scanned_map(&mut self) { let shown = (self.active_document()) .and_then(|d| d.path.clone()) .and_then(|path| match opened_map(&path) { @@ -312,7 +312,7 @@ impl AppState { } let edited = match (&*body, tree) { (MapBody::Data(read), Some(tree)) => Some(Arc::new(MapBody::Data( - super::gta6_map_edit::synced(read, tree), + crate::state::gta6_map_edit::synced(read, tree), ))), _ => None, }; @@ -447,7 +447,7 @@ impl AppState { .and_then(|s| scanned_body(&s.path)) .map(|(archive, _)| archive.to_path_buf()); if let Some(archive) = archive { - self.load_file(super::rpf9_scan::body_path( + self.load_file(crate::state::rpf9_scan::body_path( &archive, offset, View::Drawable, @@ -456,20 +456,20 @@ impl AppState { } /// The searches still running, as the job list draws them. - pub(super) fn map_search_jobs(&self) -> impl Iterator + '_ { + pub(in crate::state) fn map_search_jobs(&self) -> impl Iterator + '_ { (self.map_search.iter().filter_map(ArchetypeSearch::job)) .chain(self.models_in_place_job()) - .chain(super::gta6_world::fill::job()) + .chain(crate::state::gta6_world::fill::job()) .chain(entity::job()) .chain((self.workbench.maps.gta6.world_removal.as_ref()).and_then(WorldRemoval::job)) - .chain(super::gta6_world::worldview::viewer().job()) + .chain(crate::state::gta6_world::worldview::viewer().job()) } /// Ask every search to stop; each says it stopped once its worker sees the stop. - pub(super) fn stop_map_search(&self) { + pub(in crate::state) fn stop_map_search(&self) { self.map_search.iter().for_each(|s| s.cancel.set()); self.stop_models_in_place(); - super::gta6_world::fill::stop(); + crate::state::gta6_world::fill::stop(); entity::stop(); if let Some(removal) = &self.workbench.maps.gta6.world_removal { removal.stop(); @@ -477,7 +477,7 @@ impl AppState { } /// Say in the job list how each search that ended went, and drop it. - pub(super) fn poll_map_search(&mut self) { + pub(in crate::state) fn poll_map_search(&mut self) { let mut ended = Vec::new(); self.map_search.retain(|s| match s.ended() { Some(e) => { @@ -520,12 +520,12 @@ impl AppState { self.jobs.record(JobKind::ArchetypeSearch, outcome, said); } // ponytail: a fill of the world is listed as an archetype search, whose Stop stops it; a kind of its own if the two are ever told apart in the list. - if let Some((outcome, said)) = super::gta6_world::fill::ended() { + if let Some((outcome, said)) = crate::state::gta6_world::fill::ended() { self.jobs.record(JobKind::ArchetypeSearch, outcome, said); } self.poll_entity_edit(); self.poll_world_removal(); - let indexed = super::gta6_world::worldview::viewer().ended(); + let indexed = crate::state::gta6_world::worldview::viewer().ended(); if let Some((outcome, said)) = indexed { self.jobs.record(JobKind::WorldIndex, outcome, said); } @@ -575,7 +575,7 @@ impl AppState { /// How a search ended. #[derive(Debug, Clone, PartialEq, Eq)] -pub(super) enum SearchEnded { +pub(in crate::state) enum SearchEnded { /// How many archetypes and models it found, each with how many it looked for. Found { archetypes: (usize, usize), @@ -593,7 +593,7 @@ struct Wanted { dictionaries: bool, } -pub(super) struct ArchetypeSearch { +pub(in crate::state) struct ArchetypeSearch { doing: String, cancel: Cancel, progress: Progress, @@ -739,7 +739,7 @@ fn types_at(archive: &Path, file: &File, offset: u64) -> Vec { match map::links::open(virtual_section, physical) { Ok((MapBody::Types(t), read)) => { links::keep_read_interiors(archive, &read); - super::gta6_world::keep_searched_types(&t, virtual_section, physical); + crate::state::gta6_world::keep_searched_types(&t, virtual_section, physical); t.archetypes } _ => Vec::new(), @@ -760,18 +760,13 @@ fn model_at(file: &File, offset: u64) -> Option { or_io::gta6::headerless::stated_model_word(resource.sections(&bytes).0).ok() } -#[path = "gta6_map_links.rs"] pub(crate) mod links; -#[path = "gta6_map_entity.rs"] mod entity; -#[path = "gta6_world_delete.rs"] mod world_delete; pub(crate) use world_delete::WorldRemoval; -#[path = "gta6_map_types_edit.rs"] mod types_edit; #[cfg(test)] -#[path = "gta6_map_tests.rs"] mod tests; diff --git a/src/state/gta6_map_tests.rs b/src/state/gta6/world/gta6_map/tests.rs similarity index 99% rename from src/state/gta6_map_tests.rs rename to src/state/gta6/world/gta6_map/tests.rs index 70a86e7b6..1da7e2597 100644 --- a/src/state/gta6_map_tests.rs +++ b/src/state/gta6/world/gta6_map/tests.rs @@ -2,9 +2,9 @@ use std::time::{Duration, Instant}; use or_io::gta6::map::{Aabb, InstanceList}; -use super::super::opening_an_rpf9_archive::{rpf9_head, scanned, written, zlib}; use super::*; use crate::state::document::MetaDocument; +use crate::state::opening_an_rpf9_archive::{rpf9_head, scanned, written, zlib}; use crate::state::rpf9_scan::body_path; use crate::state::workbench::{Pick, PickKind}; diff --git a/src/state/gta6_map_types_edit.rs b/src/state/gta6/world/gta6_map/types_edit.rs similarity index 100% rename from src/state/gta6_map_types_edit.rs rename to src/state/gta6/world/gta6_map/types_edit.rs diff --git a/src/state/gta6_world_delete.rs b/src/state/gta6/world/gta6_map/world_delete.rs similarity index 100% rename from src/state/gta6_world_delete.rs rename to src/state/gta6/world/gta6_map/world_delete.rs diff --git a/src/state/gta6_map_edit.rs b/src/state/gta6/world/gta6_map_edit.rs similarity index 96% rename from src/state/gta6_map_edit.rs rename to src/state/gta6/world/gta6_map_edit.rs index f7f318280..33322a14f 100644 --- a/src/state/gta6_map_edit.rs +++ b/src/state/gta6/world/gta6_map_edit.rs @@ -25,8 +25,8 @@ use or_world_gta6::edit::{ self, extents, name, Refused, Set, ENTITIES, POSITION, ROTATION, SCALE_XY, SCALE_Z, }; -use super::presets::MetaStep; -use super::{AppState, Change, DocPayload, DocumentId, MetaEdit}; +use crate::state::presets::MetaStep; +use crate::state::{AppState, Change, DocPayload, DocumentId, MetaEdit}; const ARCHETYPE_NAME: u32 = lit(b"archetypeName"); /// The archetype's 64-bit name word an entity names it by. @@ -64,7 +64,7 @@ fn set_name(v: &Value) -> Option { } /// Why a map's tree did not take an edit, in the language in use. -pub(super) fn refused_said(why: Refused) -> String { +pub(in crate::state) fn refused_said(why: Refused) -> String { match why { Refused::NotFinite => { tr!("A placement whose numbers are not all finite is not written.").to_string() @@ -78,7 +78,7 @@ pub(super) fn refused_said(why: Refused) -> String { } /// `m` with each entity's placement and archetype as `tree` holds them. -pub(super) fn synced(m: &MapData, tree: &MetaInstance) -> MapData { +pub(in crate::state) fn synced(m: &MapData, tree: &MetaInstance) -> MapData { let mut m = m.clone(); if let Some((entities, streaming)) = extents::extents_of(tree) { (m.entities_extents, m.streaming_extents) = (entities, streaming); @@ -131,7 +131,7 @@ fn read_into(e: &mut Entity, inst: &MetaInstance, names: &[String; 6]) { impl AppState { /// The revision of the metadata tree of the document at `path`, and the tree once it is edited. - pub(super) fn edited_map_tree(&self, path: &Path) -> (u64, Option<&MetaInstance>) { + pub(in crate::state) fn edited_map_tree(&self, path: &Path) -> (u64, Option<&MetaInstance>) { let meta = self.documents.iter().find_map(|d| match &d.payload { DocPayload::Meta(meta) if d.path.as_deref() == Some(path) => Some(meta), _ => None, @@ -198,9 +198,9 @@ impl AppState { /// where a GTA VI tree's row opened it, else only as a file of its own. pub(crate) fn scanned_map_save_note(&self) -> &'static str { let path = self.scanned_map().map(|s| s.path.as_path()); - match path.and_then(|p| super::rpf_archive_open::tree_open::row_of(self, p)) { + match path.and_then(|p| crate::state::rpf_archive_open::tree_open::row_of(self, p)) { Some(_) => tr!("This body was opened from its row of a GTA VI archive's tree: Save writes its edits into that row, and the archive's Save as… writes a new file, a patched copy where the body fits its entry's chunks, whose table is unchanged and which no run of the game has loaded, else a rebuilt archive, which the game refuses because only its maker can sign the table."), - None => crate::i18n::tr(super::rpf9_scan::READ_ONLY_BODY), + None => crate::i18n::tr(crate::state::rpf9_scan::READ_ONLY_BODY), } } @@ -211,10 +211,12 @@ impl AppState { .filter_map(|d| d.path.as_deref()) .collect(); let shown = self.scanned_map(); - if let Some((archive, _)) = shown.and_then(|s| super::rpf9_scan::scanned_body(&s.path)) { + if let Some((archive, _)) = + shown.and_then(|s| crate::state::rpf9_scan::scanned_body(&s.path)) + { held.push(archive); } - super::gta6_map::links::interior_in(&held, word) + crate::state::gta6_map::links::interior_in(&held, word) } /// The archetypes entity `index` of the scanned map shown may take, as (word, name). @@ -347,7 +349,7 @@ impl AppState { } /// Stand entity `index` of the map document `doc` at `pose`, its extents grown to hold it, as one step of Undo: `e` is its record and `archetype` its archetype where one is known. Whether an extent grew to hold its position only. - pub(super) fn place_map_entity( + pub(in crate::state) fn place_map_entity( &mut self, doc: DocumentId, index: usize, @@ -370,7 +372,7 @@ impl AppState { /// Set `sets` in the tree of the map document `doc`, one step of Undo; nothing where each /// already holds its value, and nothing at all where one is not found. - pub(super) fn set_map_entity( + pub(in crate::state) fn set_map_entity( &mut self, doc: DocumentId, sets: &[Set], @@ -379,7 +381,9 @@ impl AppState { let document = (self.document_mut(doc)) .ok_or_else(|| tr!("The scanned map's document is closed.").to_string())?; // A scanned body saves its edits as a copy, so its map edits as its form does. - if let Some(why) = (document.read_only).filter(|w| *w != super::rpf9_scan::READ_ONLY_BODY) { + if let Some(why) = + (document.read_only).filter(|w| *w != crate::state::rpf9_scan::READ_ONLY_BODY) + { return Err(crate::i18n::tr(why).to_string()); } let DocPayload::Meta(meta) = &mut document.payload else { @@ -505,7 +509,7 @@ mod tests { entity(false, OTHER, 0xBBBB_0002), entity(true, 0x55, 0xCCCC_0003), ]; - super::super::gta6_map::keep_read(&path, MapBody::Data(map(entities.clone()))); + crate::state::gta6_map::keep_read(&path, MapBody::Data(map(entities.clone()))); let mut meta = MetaDocument::empty(); meta.parsed.as_mut().expect("a tree").instance = tree(&entities); let mut state = AppState::new(); @@ -578,7 +582,7 @@ mod tests { let mut e = entity(false, WORD, 0xAAAA_0001); e.lod_dist = 40.0; let read = map(vec![e.clone()]); - super::super::gta6_map::keep_read(&path, MapBody::Data(read.clone())); + crate::state::gta6_map::keep_read(&path, MapBody::Data(read.clone())); let mut root = tree(std::slice::from_ref(&e)); let extents = [ ("entitiesExtentsMin", read.entities_extents.min), diff --git a/src/state/gta6_world_fill.rs b/src/state/gta6/world/gta6_world/fill.rs similarity index 100% rename from src/state/gta6_world_fill.rs rename to src/state/gta6/world/gta6_world/fill.rs diff --git a/src/state/gta6_world.rs b/src/state/gta6/world/gta6_world/mod.rs similarity index 93% rename from src/state/gta6_world.rs rename to src/state/gta6/world/gta6_world/mod.rs index 0f252ec9c..1a319a6c0 100644 --- a/src/state/gta6_world.rs +++ b/src/state/gta6/world/gta6_world/mod.rs @@ -15,7 +15,7 @@ use or_io::gta6::map::lights::{self, LightEffect, LightOwner, MapLights, Pose}; use or_io::gta6::map::world::{Grid, PlacementIndex, PlacementRow, WorldKind}; use or_io::gta6::map::{self, MapBody, MapData, MapTypes}; -use super::gta6_map::ScannedMap; +use crate::state::gta6_map::ScannedMap; /// A light as the plan draws it: where it stands on the ground plane, its colour and its range. #[derive(Debug, Clone, Copy, PartialEq)] @@ -130,7 +130,7 @@ fn is_full(level: u8) -> bool { } impl Area { - pub(super) fn new(archive: PathBuf, filled: Filled) -> Self { + pub(in crate::state) fn new(archive: PathBuf, filled: Filled) -> Self { let at = |r: &PlacementRow| [r.position[0], r.position[1]]; // A point that is not finite is in no cell and still counts in the order. let nowhere = [f32::NAN; 2]; @@ -194,7 +194,7 @@ impl Area { /// The name of the archetype `row` places where the names kept of the bodies harvested hold it, /// else its hash. pub fn archetype_name(row: &PlacementRow) -> String { - let names = super::gta6_names::vocabulary(); + let names = crate::state::gta6_names::vocabulary(); (names.confirmed(row.archetype_name, row.archetype_word)) .map_or_else(|| format!("{:#010X}", row.archetype_name), str::to_string) } @@ -229,13 +229,13 @@ pub fn world() -> MutexGuard<'static, World> { } /// Keep what the world readers read of the scanned body at `path`, after the map reader kept it. -pub(super) fn keep(path: &Path, virtual_section: &[u8], physical: &[u8]) { +pub(in crate::state) fn keep(path: &Path, virtual_section: &[u8], physical: &[u8]) { let Some(kind) = map::root_type(virtual_section).and_then(WorldKind::of_root) else { return; }; match kind { WorldKind::MapData | WorldKind::MapTypes => { - let body = super::gta6_map::opened_map(path).and_then(Result::ok); + let body = crate::state::gta6_map::opened_map(path).and_then(Result::ok); let found = lights::open(virtual_section, physical).ok(); let mut world = world(); match (body.as_deref(), &found) { @@ -260,7 +260,11 @@ pub(super) fn keep(path: &Path, virtual_section: &[u8], physical: &[u8]) { /// Keep the archetype lights of `types`, a map types body a search of a scan read from these two /// sections. // ponytail: the light reader reads the body's tables again after the map reader; hand it the model if a search is slow. -pub(super) fn keep_searched_types(types: &MapTypes, virtual_section: &[u8], physical: &[u8]) { +pub(in crate::state) fn keep_searched_types( + types: &MapTypes, + virtual_section: &[u8], + physical: &[u8], +) { if let Ok(found) = lights::open(virtual_section, physical) { if !found.effects.is_empty() { world().keep_archetype_lights(types, &found); @@ -315,7 +319,7 @@ impl World { if map.entities.is_empty() || self.indexed.iter().any(|p| p == path) { return; } - let offset = super::rpf9_scan::scanned_body(path).map_or(0, |(_, offset)| offset); + let offset = crate::state::rpf9_scan::scanned_body(path).map_or(0, |(_, offset)| offset); self.placed.add(offset, map); self.indexed.push(path.to_path_buf()); } @@ -403,26 +407,28 @@ impl World { } } -impl super::AppState { +impl crate::state::AppState { /// Read the world of the archive the map shown is a body of, on a worker: every map of it, or /// those whose streaming box meets `region` of the ground plane. The bodies are those the open /// scan of the archive lists once it has ended, else the archive is scanned for them. pub(crate) fn fill_gta6_world(&mut self, region: Option) -> Result<(), String> { let archive = (self.scanned_map()) - .and_then(|s| super::rpf9_scan::scanned_body(&s.path)) + .and_then(|s| crate::state::rpf9_scan::scanned_body(&s.path)) .map(|(archive, _)| archive.to_path_buf()) .ok_or_else(|| { tr!("This map is no body of a scanned archive, so no archive holds the world around it.") .to_string() })?; let offsets = self.documents.iter().find_map(|d| match &d.payload { - super::DocPayload::Rpf9(scan) if scan.path == archive && scan.start == 0 => { + crate::state::DocPayload::Rpf9(scan) if scan.path == archive && scan.start == 0 => { let found = scan.found(); - let whole = found.ended == Some(super::rpf9_scan::Ended::Whole); + let whole = found.ended == Some(crate::state::rpf9_scan::Ended::Whole); whole.then(|| { (found.rows.iter()) .filter_map(|row| match row { - super::rpf9_scan::Row::Body(find) if fill::starts_a_resource(find) => { + crate::state::rpf9_scan::Row::Body(find) + if fill::starts_a_resource(find) => + { Some(find.offset) } _ => None, @@ -438,17 +444,17 @@ impl super::AppState { /// Open the map body at `offset` of the archive at `archive`, as its row of the scan opens it. pub(crate) fn open_gta6_map_body(&mut self, archive: &Path, offset: u64) { - let view = super::rpf9_scan::View::Headerless; - self.open_scanned_path(super::rpf9_scan::body_path(archive, offset, view), false); + let view = crate::state::rpf9_scan::View::Headerless; + self.open_scanned_path( + crate::state::rpf9_scan::body_path(archive, offset, view), + false, + ); } } -#[path = "gta6_world_fill.rs"] pub(crate) mod fill; -#[path = "gta6_worldview/mod.rs"] pub(crate) mod worldview; #[cfg(test)] -#[path = "gta6_world_tests.rs"] mod tests; diff --git a/src/state/gta6_world_tests.rs b/src/state/gta6/world/gta6_world/tests.rs similarity index 100% rename from src/state/gta6_world_tests.rs rename to src/state/gta6/world/gta6_world/tests.rs diff --git a/src/state/gta6_worldview/edit_tests.rs b/src/state/gta6/world/gta6_world/worldview/edit.rs similarity index 100% rename from src/state/gta6_worldview/edit_tests.rs rename to src/state/gta6/world/gta6_world/worldview/edit.rs diff --git a/src/state/gta6_worldview/stream_grass.rs b/src/state/gta6/world/gta6_world/worldview/grass.rs similarity index 100% rename from src/state/gta6_worldview/stream_grass.rs rename to src/state/gta6/world/gta6_world/worldview/grass.rs diff --git a/src/state/gta6_worldview/index.rs b/src/state/gta6/world/gta6_world/worldview/index.rs similarity index 100% rename from src/state/gta6_worldview/index.rs rename to src/state/gta6/world/gta6_world/worldview/index.rs diff --git a/src/state/gta6_worldview/keys_tests.rs b/src/state/gta6/world/gta6_world/worldview/keys.rs similarity index 100% rename from src/state/gta6_worldview/keys_tests.rs rename to src/state/gta6/world/gta6_world/worldview/keys.rs diff --git a/src/state/gta6_worldview/mod.rs b/src/state/gta6/world/gta6_world/worldview/mod.rs similarity index 99% rename from src/state/gta6_worldview/mod.rs rename to src/state/gta6/world/gta6_world/worldview/mod.rs index a9c014312..f07406043 100644 --- a/src/state/gta6_worldview/mod.rs +++ b/src/state/gta6/world/gta6_world/worldview/mod.rs @@ -19,29 +19,22 @@ use crate::state::jobs::{JobKind, Outcome, RunningJob, Then}; use crate::ui::panels::log::grouped; #[cfg(test)] -#[path = "edit_tests.rs"] mod edit; -#[path = "stream_grass.rs"] mod grass; pub(crate) mod index; #[cfg(test)] -#[path = "keys_tests.rs"] mod keys; mod model; #[cfg(test)] -#[path = "pick_tests.rs"] mod pick; #[cfg(test)] -#[path = "reference_tests.rs"] mod reference; mod sky; #[cfg(test)] -#[path = "stream_viewer_tests.rs"] mod stream_viewer; mod texture; pub(crate) mod water; #[cfg(test)] -#[path = "whole_tests.rs"] mod whole; pub use interior::Inside; diff --git a/src/state/gta6_worldview/model.rs b/src/state/gta6/world/gta6_world/worldview/model/mod.rs similarity index 99% rename from src/state/gta6_worldview/model.rs rename to src/state/gta6/world/gta6_world/worldview/model/mod.rs index 280788372..f980a51d6 100644 --- a/src/state/gta6_worldview/model.rs +++ b/src/state/gta6/world/gta6_world/worldview/model/mod.rs @@ -207,5 +207,4 @@ pub(super) fn read_model( } #[cfg(test)] -#[path = "model_tests.rs"] mod tests; diff --git a/src/state/gta6_worldview/model_tests.rs b/src/state/gta6/world/gta6_world/worldview/model/tests.rs similarity index 100% rename from src/state/gta6_worldview/model_tests.rs rename to src/state/gta6/world/gta6_world/worldview/model/tests.rs diff --git a/src/state/gta6_worldview/pick_tests.rs b/src/state/gta6/world/gta6_world/worldview/pick.rs similarity index 100% rename from src/state/gta6_worldview/pick_tests.rs rename to src/state/gta6/world/gta6_world/worldview/pick.rs diff --git a/src/state/gta6_worldview/reference_tests.rs b/src/state/gta6/world/gta6_world/worldview/reference/mod.rs similarity index 99% rename from src/state/gta6_worldview/reference_tests.rs rename to src/state/gta6/world/gta6_world/worldview/reference/mod.rs index fb26bd51e..c214a09d2 100644 --- a/src/state/gta6_worldview/reference_tests.rs +++ b/src/state/gta6/world/gta6_world/worldview/reference/mod.rs @@ -26,7 +26,7 @@ use super::{model, sky, water, Viewer}; use crate::ui::panels::world_viewer::Pose; /// The script whose cameras, hours and modes the selections are digested at. -const SCRIPT: &str = include_str!("../../../scripts/shots/gta6_world_reference.shots"); +const SCRIPT: &str = include_str!("../../../../../../../scripts/shots/gta6_world_reference.shots"); /// The folder of the GTA VI build. const BUILD_ENV: &str = "OPENRAGE_GTA6_BUILD"; @@ -656,7 +656,6 @@ fn digests(root: &Path) -> Digests { out } -#[path = "reference_parts_tests.rs"] mod parts; /// The digests of the build, written or held: the one test that reads the install. diff --git a/src/state/gta6_worldview/reference_parts_tests.rs b/src/state/gta6/world/gta6_world/worldview/reference/parts.rs similarity index 100% rename from src/state/gta6_worldview/reference_parts_tests.rs rename to src/state/gta6/world/gta6_world/worldview/reference/parts.rs diff --git a/src/state/gta6_worldview/sky.rs b/src/state/gta6/world/gta6_world/worldview/sky.rs similarity index 100% rename from src/state/gta6_worldview/sky.rs rename to src/state/gta6/world/gta6_world/worldview/sky.rs diff --git a/src/state/gta6_worldview/stream_viewer_tests.rs b/src/state/gta6/world/gta6_world/worldview/stream_viewer.rs similarity index 100% rename from src/state/gta6_worldview/stream_viewer_tests.rs rename to src/state/gta6/world/gta6_world/worldview/stream_viewer.rs diff --git a/src/state/gta6_worldview/texture.rs b/src/state/gta6/world/gta6_world/worldview/texture/mod.rs similarity index 99% rename from src/state/gta6_worldview/texture.rs rename to src/state/gta6/world/gta6_world/worldview/texture/mod.rs index 4db6e3efc..62da8510a 100644 --- a/src/state/gta6_worldview/texture.rs +++ b/src/state/gta6/world/gta6_world/worldview/texture/mod.rs @@ -244,5 +244,4 @@ fn dictionary_texture((archive, bodies): &DictionaryPlaces, key: u64) -> Option< } #[cfg(test)] -#[path = "texture_tests.rs"] mod tests; diff --git a/src/state/gta6_worldview/texture_tests.rs b/src/state/gta6/world/gta6_world/worldview/texture/tests.rs similarity index 100% rename from src/state/gta6_worldview/texture_tests.rs rename to src/state/gta6/world/gta6_world/worldview/texture/tests.rs diff --git a/src/state/gta6_worldview/water_ground.rs b/src/state/gta6/world/gta6_world/worldview/water/ground.rs similarity index 100% rename from src/state/gta6_worldview/water_ground.rs rename to src/state/gta6/world/gta6_world/worldview/water/ground.rs diff --git a/src/state/gta6_worldview/water.rs b/src/state/gta6/world/gta6_world/worldview/water/mod.rs similarity index 99% rename from src/state/gta6_worldview/water.rs rename to src/state/gta6/world/gta6_world/worldview/water/mod.rs index 5fe5994c5..182b0561a 100644 --- a/src/state/gta6_worldview/water.rs +++ b/src/state/gta6/world/gta6_world/worldview/water/mod.rs @@ -11,7 +11,6 @@ use std::sync::{Arc, Mutex, OnceLock}; use or_io::container::rpf::read_rpf9_body; use or_io::gta6::water::WaterData; -#[path = "water_ground.rs"] mod ground; pub use ground::ground; diff --git a/src/state/gta6_worldview/whole_tests.rs b/src/state/gta6/world/gta6_world/worldview/whole.rs similarity index 100% rename from src/state/gta6_worldview/whole_tests.rs rename to src/state/gta6/world/gta6_world/worldview/whole.rs diff --git a/src/state/gta6_world_edit.rs b/src/state/gta6/world/gta6_world_edit.rs similarity index 96% rename from src/state/gta6_world_edit.rs rename to src/state/gta6/world/gta6_world_edit.rs index 53e30da77..5129b4ee4 100644 --- a/src/state/gta6_world_edit.rs +++ b/src/state/gta6/world/gta6_world_edit.rs @@ -21,12 +21,12 @@ use or_world::sentence::Sentence; use or_world::transform::Pose; use or_world_gta6::edit::{self, POSITION, ROTATION, SCALE_XY, SCALE_Z}; -use super::gta6_map::opened_map; -use super::gta6_map_edit::refused_said; -use super::rpf9_scan::scanned_body; -use super::workbench::{pose_of_picked, WorldChange}; -use super::world_session::LaidTree; -use super::{AppState, DocPayload, DocumentId}; +use crate::state::gta6_map::opened_map; +use crate::state::gta6_map_edit::refused_said; +use crate::state::rpf9_scan::scanned_body; +use crate::state::workbench::{pose_of_picked, WorldChange}; +use crate::state::world_session::LaidTree; +use crate::state::{AppState, DocPayload, DocumentId}; /// The bytes a map body is read to. const BODY_LIMIT: u64 = 256 << 20; @@ -73,7 +73,7 @@ impl AppState { } /// The map body at `path`, a body of an archive, opened as a document behind the screen on show. - pub(super) fn open_world_map(&mut self, path: &Path) -> Result { + pub(in crate::state) fn open_world_map(&mut self, path: &Path) -> Result { let no_body = || tr!("The world names what is selected by no body of an archive").to_string(); let (archive, offset) = scanned_body(path).ok_or_else(no_body)?; @@ -86,7 +86,7 @@ impl AppState { } /// Change what the World screen has selected of a GTA VI map as `change` says, as one step of its map's document. - pub(super) fn edit_gta6_world_selection(&mut self, change: WorldChange) { + pub(in crate::state) fn edit_gta6_world_selection(&mut self, change: WorldChange) { if let Err(why) = self.try_edit_gta6_world_selection(change) { self.show_error_toast(why); } diff --git a/src/state/gta6_world_fits.rs b/src/state/gta6/world/gta6_world_fits.rs similarity index 96% rename from src/state/gta6_world_fits.rs rename to src/state/gta6/world/gta6_world_fits.rs index 36b18d3b3..6b8912f72 100644 --- a/src/state/gta6_world_fits.rs +++ b/src/state/gta6/world/gta6_world_fits.rs @@ -11,8 +11,8 @@ use std::sync::{Arc, Mutex}; use or_io::container::rpf::GtaViKeys; use or_job::Cancel; -use super::rpf_archive_open::tree_verbs::Writes; -use super::{AppState, DocPayload}; +use crate::state::rpf_archive_open::tree_verbs::Writes; +use crate::state::{AppState, DocPayload}; /// Where a plan finds the keys the archive's tables open with. pub(crate) type Keys = fn() -> Result, String>; @@ -81,7 +81,10 @@ impl AppState { /// Ask whether the map document at `path` still fits its place, as it stands now: a worker plans its save and [`Self::world_fit`] says the answer. pub(in crate::state) fn world_fit_is_asked(&mut self, path: &Path) { let keys = self.workbench.maps.gta6.world_fits.keys; - self.world_fit_is_asked_with(path, keys.unwrap_or(super::rpf9_scan::rpf9_table::keys)); + self.world_fit_is_asked_with( + path, + keys.unwrap_or(crate::state::rpf9_scan::rpf9_table::keys), + ); } /// [`Self::world_fit_is_asked`], the plan and every later one finding its keys through `keys`. diff --git a/src/state/gta6/world/mod.rs b/src/state/gta6/world/mod.rs new file mode 100644 index 000000000..d0b96adb7 --- /dev/null +++ b/src/state/gta6/world/mod.rs @@ -0,0 +1,5 @@ +pub(crate) mod gta6_map; +pub(crate) mod gta6_map_edit; +pub(crate) mod gta6_world; +pub(crate) mod gta6_world_edit; +pub(crate) mod gta6_world_fits; diff --git a/src/state/mod.rs b/src/state/mod.rs index 4a875df39..4cbc2ad52 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -1,84 +1,6 @@ -#[cfg(test)] -mod a_b_compares_the_pack_with_its_previous_kept_version; -#[cfg(test)] -mod a_bones_numbers_can_be_edited; -#[cfg(test)] -mod a_change_on_disk_keeps_the_undo_steps_beside_it; -#[cfg(test)] -mod a_drag_carries_every_selected_row; -#[cfg(test)] -mod a_drag_copies_and_a_change_of_nothing_does_nothing; -#[cfg(test)] -mod a_field_that_shapes_the_data_is_not_edited_in_place; -#[cfg(test)] -mod a_garments_cloth_is_linked_and_its_shop_ids_are_kept; -#[cfg(test)] -mod a_gta_vi_archive_s_scan_is_kept; -#[cfg(test)] -mod a_model_is_drawn_with_its_own_textures; -#[cfg(test)] -mod a_moved_or_deleted_archive_row_leaves_nothing_behind; -#[cfg(test)] -mod a_new_project; -#[cfg(test)] -mod a_pick_in_the_preview_opens_its_document_at_its_row; -#[cfg(test)] -mod a_pinned_inspector_shows_its_own_document; -#[cfg(test)] -mod a_plugin_asks_before_it_runs; -#[cfg(test)] -mod a_project_holds_only_sources; -#[cfg(test)] -mod a_recook_reloads_what_is_open; -#[cfg(test)] -mod a_rename_on_disk_waits_for_the_extraction_reading_it; -#[cfg(test)] -mod a_right_click_or_a_drag_selects_its_row; -#[cfg(test)] -mod a_save_names_its_destination; -#[cfg(test)] -mod a_self_check_keeps_to_itself; -#[cfg(test)] -mod a_skeleton_is_seen_without_an_animation; -#[cfg(test)] -mod a_wardrobe_edit_is_recoverable; -#[cfg(test)] -mod adding_a_format; -#[cfg(test)] -mod adding_particle_files_is_an_import; -#[cfg(test)] -mod adding_weapons_is_an_import; -#[cfg(test)] -mod an_alt_click_in_the_viewport_picks_a_model; -#[cfg(test)] -mod an_awc_animation_is_written_back; -#[cfg(test)] -mod an_awc_stream_opens_its_animation; -#[cfg(test)] -mod an_edit_of_the_wardrobe_is_a_step_of_undo; -#[cfg(test)] -mod an_edit_stays_where_it_was_made; -#[cfg(test)] -mod an_error_names_what_failed; -#[cfg(test)] -mod an_export_asks_before_it_alters_the_bytes; -#[cfg(test)] -mod an_extraction_holds_back_only_the_files_it_reads; -#[cfg(test)] -mod an_import_ends_with_a_toast_that_says_what_was_done_and_takes_it_back; -#[cfg(test)] -mod an_undo_finishes_or_says_why; mod animation_session; -#[cfg(test)] -mod applying_a_preset; -#[cfg(test)] -mod authoring; pub mod batch; pub mod bone_numbers; -#[cfg(test)] -mod building_a_dlc_pack_from_the_app; -#[cfg(test)] -mod building_targets_from_the_app; pub mod capabilities; mod clip_regions; pub mod clipboard; @@ -86,56 +8,18 @@ mod closing; pub(crate) mod cloth_helpers; mod clothing; pub mod compare; -#[cfg(test)] -mod comparing_every_resource_and_archive; -#[cfg(test)] -mod comparing_two_files; pub mod convert; mod convert_words; -#[cfg(test)] -mod converting_from_the_app; -#[cfg(test)] -mod converting_in_a_modders_words; -#[cfg(test)] -mod converting_is_listed_and_asked_inside_its_panel; -#[cfg(test)] -mod copy_cut_and_paste; pub mod dds_document; pub mod defrag_job; -#[cfg(test)] -mod defragmenting_an_archive; pub mod delete_prompt; pub mod dependencies; -#[cfg(test)] -mod destructive_file_operations_ask; pub mod dlc_pack; mod document; mod document_io; pub mod drivers; -#[cfg(test)] -mod dropped_files; -#[cfg(test)] -mod dropping_and_importing_folders; mod edit_history; -#[cfg(test)] -mod editing_a_clip; -#[cfg(test)] -mod enhanced_controls_say_so; pub mod entry_preview; -#[cfg(test)] -mod every_add_lands_where_the_tree_shows_it; -#[cfg(test)] -mod every_edit_undoes; -#[cfg(test)] -mod every_question_fits_a_narrow_window; -#[cfg(test)] -mod every_view_follows_every_edit; -#[cfg(test)] -mod every_viewer_path_takes_both_targets; -#[cfg(test)] -mod every_write_asks_the_jobs_reading_it; -#[cfg(test)] -mod every_write_into_a_folder_a_job_reads_is_refused; mod expander; pub mod explorer; pub mod extract_job; @@ -144,100 +28,50 @@ pub mod file_index; pub(crate) mod file_io; pub mod file_watcher; pub mod files_view; -#[cfg(test)] -mod fix_all_safe_and_the_optimiser_in_the_app; pub mod format_handlers; pub mod frame_stats; pub mod front_door; pub mod game_discovery; mod game_pack; pub mod gltf; -#[cfg(test)] -mod gltf_in_and_out_from_the_app; -#[cfg(test)] -mod going_to_a_file; -mod gta6_anim_edit; -mod gta6_anim_in_audio_save; -pub(crate) mod gta6_anim_keys; -pub(crate) mod gta6_anim_play; -pub(crate) mod gta6_audio_links; -mod gta6_bone_edit; -pub(crate) mod gta6_bound; -mod gta6_bound_vertex; -pub(crate) mod gta6_clip_finding; -pub(crate) mod gta6_collision_edit; -mod gta6_constant_types; -pub(crate) mod gta6_dialogue; -mod gta6_dictionary_index; -mod gta6_dictionary_write; -pub(crate) mod gta6_edit; -mod gta6_effect_facts; -mod gta6_effects; -mod gta6_embedded_edit; -pub(crate) mod gta6_entry_skeletons; -mod gta6_export; -pub(crate) mod gta6_expression_edit; -pub(crate) mod gta6_face; -pub(crate) mod gta6_filter_edit; -mod gta6_filter_entries; -mod gta6_first_entry; -mod gta6_fragment; -mod gta6_fragment_records; -mod gta6_gltf_import; -pub(crate) mod gta6_head; -mod gta6_install_harvest; -pub(crate) mod gta6_install_scan; -pub(crate) mod gta6_key_words; -pub(crate) mod gta6_learned_names; -pub(crate) mod gta6_map; -mod gta6_map_edit; -pub(crate) mod gta6_world_edit; -mod gta6_world_fits; -pub use gta6_world_fits::{Fit as WorldFit, WorldFits}; -pub(crate) mod gta6_material_declared; -pub(crate) mod gta6_material_layout; -mod gta6_meta_save; -pub(crate) mod gta6_modding; -mod gta6_morph; -mod gta6_name_pool; -pub(crate) mod gta6_names; -pub(crate) mod gta6_navmesh; -mod gta6_navmesh_delete; -mod gta6_navmesh_edit; -mod gta6_object_trees; -pub(crate) mod gta6_other_bodies; -mod gta6_other_bodies_save; -pub(crate) mod gta6_particle_models; -pub(crate) mod gta6_particles; -mod gta6_particles_save; -pub(crate) mod gta6_physics_edit; -pub(crate) mod gta6_resource; -mod gta6_resource_save; -pub(crate) mod gta6_save; -pub(crate) mod gta6_selected; -pub(crate) mod gta6_set_finding; -pub(crate) mod gta6_shaders; -mod gta6_small; -mod gta6_summaries; -pub(crate) mod gta6_text; -mod gta6_texture_index; -mod gta6_texture_names_file; -mod gta6_texture_naming; -mod gta6_textures; -#[cfg(test)] -mod gta6_textures_resolve_and_save; -pub(crate) mod gta6_weapon_parts; -pub(crate) mod gta6_world; -pub(crate) mod gta_vi; -#[cfg(test)] -mod importing_game_files_from_the_app; +pub(crate) mod gta6; +pub(crate) use gta6::anim::{ + gta6_anim_edit, gta6_anim_keys, gta6_anim_play, gta6_bone_edit, gta6_clip_finding, + gta6_entry_skeletons, gta6_expression_edit, gta6_face, gta6_filter_edit, gta6_filter_entries, + gta6_set_finding, +}; +pub(crate) use gta6::audio::{gta6_audio_links, gta6_dialogue, gta6_text}; +pub(crate) use gta6::bodies::{ + gta6_meta_save, gta6_other_bodies, gta6_other_bodies_save, gta6_resource, gta6_resource_save, + gta6_save, +}; +pub(crate) use gta6::drawable::{ + gta6_constant_types, gta6_edit, gta6_effect_facts, gta6_effects, gta6_export, gta6_fragment, + gta6_fragment_records, gta6_gltf_import, gta6_head, gta6_material_declared, + gta6_material_layout, gta6_morph, gta6_selected, gta6_shaders, gta6_summaries, + gta6_weapon_parts, +}; +pub(crate) use gta6::install::{ + gta6_first_entry, gta6_install_harvest, gta6_install_scan, gta6_key_words, gta6_learned_names, + gta6_name_pool, gta6_names, gta6_object_trees, gta6_small, gta_vi, +}; +pub(crate) use gta6::modding as gta6_modding; +pub(crate) use gta6::particles::{gta6_particle_models, gta6_particles, gta6_particles_save}; +pub(crate) use gta6::physics::{ + gta6_bound, gta6_collision_edit, gta6_navmesh, gta6_navmesh_delete, gta6_navmesh_edit, + gta6_physics_edit, +}; +pub(crate) use gta6::textures::{ + gta6_dictionary_index, gta6_dictionary_write, gta6_embedded_edit, gta6_texture_index, + gta6_texture_naming, gta6_textures, +}; +pub use gta6::world::gta6_world_fits::{Fit as WorldFit, WorldFits}; +pub(crate) use gta6::world::{gta6_map, gta6_map_edit, gta6_world, gta6_world_edit}; mod install_lifecycle; pub mod jobs; mod keys; pub mod kinds; mod load_error; -#[cfg(test)] -mod maps_and_a_budget_in_the_app; mod materials_palette; pub mod memory; pub(crate) mod meta_edit; @@ -247,42 +81,6 @@ mod move_network; pub mod name_index; pub mod navigation; mod navmesh_edit; -#[cfg(test)] -mod nested_archives_survive_a_save; -#[cfg(test)] -mod no_save_replaces_a_file_a_job_reads; -#[cfg(test)] -mod nothing_draws_over_what_it_belongs_to; -#[cfg(test)] -mod nothing_extracts_into_an_install; -#[cfg(test)] -mod one_place_for_background_jobs; -#[cfg(test)] -mod opening_a_dds; -#[cfg(test)] -mod opening_a_gta_vi_awc; -#[cfg(test)] -mod opening_a_gta_vi_body; -#[cfg(test)] -mod opening_a_nametable; -#[cfg(test)] -mod opening_a_rel; -#[cfg(test)] -mod opening_a_ttpf; -#[cfg(test)] -mod opening_a_ydd; -#[cfg(test)] -mod opening_an_awc; -#[cfg(test)] -mod opening_an_rpf9_archive; -#[cfg(test)] -mod opening_an_unknown_file; -#[cfg(test)] -mod opening_metadata_without_a_schema; -#[cfg(test)] -mod opening_world_dat; -#[cfg(test)] -mod opus_on_a_worker; pub mod os_drop; pub mod overlay_copy; pub mod overlay_loader; @@ -300,175 +98,38 @@ pub mod plugins; pub mod prefs; pub mod presets; pub mod preview_scene; -#[cfg(test)] -mod previewing_a_video; mod project; mod project_io; mod project_shadow; pub mod reference_names; mod reload_open_file; -#[cfg(test)] -pub(crate) mod reopening_a_built_pack_from_the_app; -#[cfg(test)] -mod reordering_mods_from_the_app; -#[cfg(test)] -mod replacing_geometry_from_the_app; pub mod retail; -mod rpf9_counted_names; -mod rpf9_kept; -mod rpf9_list; -pub mod rpf9_scan; -mod rpf_archive_open; -mod rpf_expansion; -mod rpf_moves; -mod rpf_node; -mod rpf_records; -mod rpf_session; -mod rpf_tree; -mod rpf_undo; +pub mod rpf; +pub use rpf::rpf9_scan; +pub(crate) use rpf::{ + rpf9_counted_names, rpf9_kept, rpf9_list, rpf_archive_open, rpf_node, rpf_session, rpf_undo, +}; pub mod save_destination; -#[cfg(test)] -mod saving_twice_and_into_an_archive_not_yet_opened; mod scaleform; -#[cfg(test)] -mod search_results_that_open; pub mod search_session; mod selection; pub mod selection_lookup; -#[cfg(test)] -mod settings_recents_and_small_editor_fixes; mod shader_defs; -#[cfg(test)] -mod shards; -#[cfg(test)] -mod sharing_a_project; pub mod sim; pub mod sinks; mod sky_textures; -#[cfg(test)] -mod small_faults_in_the_default_views_menus_and_keys; -#[cfg(test)] -mod small_faults_in_the_editor_and_the_previews; mod source_textures; mod tabs; -#[cfg(test)] -mod tabs_that_behave_like_an_editors; -#[cfg(test)] -pub(crate) mod test_scratch; mod texture_cache; pub mod texture_edit; pub mod texture_resolution; mod texture_tiles; pub mod textures; -#[cfg(test)] -mod the_addon_ped_in_the_app; -#[cfg(test)] -mod the_animation_preview_draws_what_its_sources_hold; -#[cfg(test)] -mod the_animation_preview_follows_its_sources; -#[cfg(test)] -mod the_default_views_in_a_modders_words; -#[cfg(test)] -mod the_dressed_ped; -#[cfg(test)] -mod the_dressed_ped_shows_sets_the_first_person_view_and_the_floor_of_heels; -#[cfg(test)] -mod the_dressed_ped_wears_props; -#[cfg(test)] -mod the_edit_mode_is_visible_and_honest; -#[cfg(test)] -mod the_files_view_in_the_centre; -#[cfg(test)] -mod the_front_door; -#[cfg(test)] -mod the_front_door_opens_and_closes; -#[cfg(test)] -mod the_gate_in_front_of_every_write; -#[cfg(test)] -mod the_grid_and_undo_survive_an_edit_of_the_contents; -#[cfg(test)] -mod the_inspector_leads_with_a_summary; -#[cfg(test)] -mod the_lock_a_window_holds; -#[cfg(test)] -mod the_map_screen_holds_a_session; -#[cfg(test)] -mod the_map_screen_saves_with_the_project; -#[cfg(test)] -mod the_mesh_doctor_in_the_app; -#[cfg(test)] -mod the_panel_counts_the_apps_cpu_state; -#[cfg(test)] -mod the_panels_around_the_viewer_take_both_targets; -#[cfg(test)] -mod the_project_history; -#[cfg(test)] -mod the_project_history_across_imports_and_projects; -#[cfg(test)] -mod the_project_polish; -#[cfg(test)] -mod the_project_screens; -#[cfg(test)] -mod the_project_workspace; -#[cfg(test)] -mod the_rules_of_a_pack_are_set_and_its_problems_written_out_from_the_app; -#[cfg(test)] -mod the_shells_regions; -#[cfg(test)] -mod the_skeleton_files_own_model_can_be_hidden; -#[cfg(test)] -mod the_two_paths_of_the_workbench_end_to_end; -#[cfg(test)] -mod the_unsaved_marker_tells_the_truth; -#[cfg(test)] -mod the_viewport_draws_every_edit; -#[cfg(test)] -mod the_viewport_picks_every_line_it_draws; -#[cfg(test)] -mod the_viewport_picks_what_it_draws; -#[cfg(test)] -mod the_wardrobe_edit_operations; -#[cfg(test)] -mod the_wardrobe_import_breadth; -#[cfg(test)] -mod the_wardrobe_workspace; -#[cfg(test)] -mod the_world_screen_adds_and_copies; -#[cfg(test)] -mod the_world_screen_edits_a_project; -#[cfg(test)] -mod the_world_screen_has_a_manipulator; -#[cfg(test)] -mod the_world_screen_shows_layers; -#[cfg(test)] -mod the_world_screen_takes_its_keys_as_commands; pub mod toasts; pub mod ttpf_document; -#[cfg(test)] -mod two_readers_of_one_archive_across_a_save; mod undo; -#[cfg(test)] -mod undo_and_the_sliders_follow_the_pinned_inspector; -#[cfg(test)] -mod undo_from_files_acts_on_what_files_shows; -#[cfg(test)] -mod uses_and_used_by_in_the_app; -#[cfg(test)] -mod uses_over_a_retail_install; -#[cfg(test)] -mod uses_reaches_every_pack; pub mod vfs_session; -#[cfg(test)] -mod viewing_never_edits; -#[cfg(test)] -mod viewport_basics_for_inspecting_assets; mod viewport_camera; -#[cfg(test)] -mod what_a_comparison_still_missed; -#[cfg(test)] -mod what_archive_rows_still_get_wrong; -#[cfg(test)] -mod what_the_create_menu_offers; pub mod workbench; pub mod workspace; pub mod world_session; @@ -492,8 +153,8 @@ pub use pending_prompts::*; pub use prefs::*; pub use preview_scene::{AnimSession, MeshSource, PreviewScene, SkeletonSource}; pub use project::*; -pub use rpf_node::*; -pub use rpf_session::*; +pub use rpf::rpf_node::*; +pub use rpf::rpf_session::*; pub use selection::*; pub use shader_defs::*; pub use texture_cache::*; @@ -1255,4 +916,11 @@ impl Default for AppState { } #[cfg(test)] -mod tests; +pub(crate) mod tests; +#[cfg(test)] +pub(crate) use tests::{ + a_plugin_asks_before_it_runs, an_awc_stream_opens_its_animation, + importing_game_files_from_the_app, nested_archives_survive_a_save, opening_a_gta_vi_awc, + opening_a_gta_vi_body, opening_a_ttpf, opening_a_ydd, opening_an_awc, opening_an_rpf9_archive, + reopening_a_built_pack_from_the_app, test_scratch, the_world_screen_has_a_manipulator, +}; diff --git a/src/state/prefs.rs b/src/state/prefs/mod.rs similarity index 99% rename from src/state/prefs.rs rename to src/state/prefs/mod.rs index 4bbb96dae..6253f8f11 100644 --- a/src/state/prefs.rs +++ b/src/state/prefs/mod.rs @@ -542,7 +542,6 @@ impl RecentFile { } } -#[path = "prefs_ago.rs"] mod prefs_ago; pub use prefs_ago::ago; diff --git a/src/state/prefs_ago.rs b/src/state/prefs/prefs_ago.rs similarity index 100% rename from src/state/prefs_ago.rs rename to src/state/prefs/prefs_ago.rs diff --git a/src/state/rpf/mod.rs b/src/state/rpf/mod.rs new file mode 100644 index 000000000..441cf0abb --- /dev/null +++ b/src/state/rpf/mod.rs @@ -0,0 +1,14 @@ +//! RPF archive sessions, tree actions, and GTA VI RPF9 scanning. + +pub(crate) mod rpf9_counted_names; +pub(crate) mod rpf9_kept; +pub(crate) mod rpf9_list; +pub mod rpf9_scan; +pub(crate) mod rpf_archive_open; +pub(crate) mod rpf_expansion; +pub(crate) mod rpf_moves; +pub(crate) mod rpf_node; +pub(crate) mod rpf_records; +pub(crate) mod rpf_session; +pub(crate) mod rpf_tree; +pub(crate) mod rpf_undo; diff --git a/src/state/rpf9_counted_names.rs b/src/state/rpf/rpf9_counted_names.rs similarity index 93% rename from src/state/rpf9_counted_names.rs rename to src/state/rpf/rpf9_counted_names.rs index e13407e3c..d3a56c640 100644 --- a/src/state/rpf9_counted_names.rs +++ b/src/state/rpf/rpf9_counted_names.rs @@ -9,7 +9,7 @@ use std::sync::{Mutex, MutexGuard}; use or_io::container::rpf::{rpf9_names_by_count_at, Rpf9BodyKind, Rpf9NamesByCount, Rpf9ScanFind}; use or_job::{Cancel, Progress}; -use super::rpf9_scan::{Ended, Found, Row, MAX_ROWS}; +use crate::state::rpf9_scan::{Ended, Found, Row, MAX_ROWS}; /// The names each nested archive opened from its parent's list ends with, by archive and header. // ponytail: one map for the whole app, which no close empties; a find is a few dozen bytes. @@ -26,7 +26,7 @@ fn lock(found: &Mutex) -> MutexGuard<'_, Found> { } /// Keep the names `found`, the list of `archive`, holds for the archive nested at `offset`. -pub(super) fn remember(archive: &Path, found: &Found, offset: u64) { +pub(in crate::state) fn remember(archive: &Path, found: &Found, offset: u64) { let own = Rpf9BodyKind::Names { archive: offset }; let names = found.rows.iter().find_map(|row| match row { Row::Body(find) if find.kind == own => Some(**find), @@ -39,7 +39,7 @@ pub(super) fn remember(archive: &Path, found: &Found, offset: u64) { /// The scan of `path` from `start`, with the names placed by count added once a whole file's /// scan ends; a nested archive whose names are known is scanned to them and ended there. -pub(super) fn counted_scan( +pub(in crate::state) fn counted_scan( path: &Path, start: u64, len: u64, @@ -50,7 +50,7 @@ pub(super) fn counted_scan( let key = (path.to_path_buf(), start); let names = known().get(&key).copied().filter(|_| start > 0); let Some(names) = names else { - let ended = super::rpf9_scan::scan(path, start, len, found, cancel, progress)?; + let ended = crate::state::rpf9_scan::scan(path, start, len, found, cancel, progress)?; if start == 0 && ended == Ended::Whole && !cancel.is_set() { if let Err(error) = place(path, found) { tracing::warn!(%error, path = %path.display(), "no names were placed by count"); @@ -65,7 +65,7 @@ pub(super) fn counted_scan( return Ok(ended); }; let to = names.offset.min(len); - let ended = super::rpf9_scan::scan(path, start, to, found, cancel, progress)?; + let ended = crate::state::rpf9_scan::scan(path, start, to, found, cancel, progress)?; Ok(end_at(found, start, names, ended)) } diff --git a/src/state/rpf9_kept.rs b/src/state/rpf/rpf9_kept.rs similarity index 95% rename from src/state/rpf9_kept.rs rename to src/state/rpf/rpf9_kept.rs index 7d5ae0f0d..17bf159af 100644 --- a/src/state/rpf9_kept.rs +++ b/src/state/rpf/rpf9_kept.rs @@ -8,13 +8,13 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH}; use or_io::container::rpf::{seal_rpf9_scan, unseal_rpf9_scan, Rpf9ScanFind}; -use super::rpf9_scan::{Ended, Found, Row, MAX_ROWS}; +use crate::state::rpf9_scan::{Ended, Found, Row, MAX_ROWS}; /// The version of what this file writes of a scan: a change to it takes another. const VERSION: u64 = 1; /// The version of the rules a scan finds and places bodies by: a change to what a scan lists of /// an archive takes another, so every scan kept before it is scanned again. -pub(super) const RULES: u64 = 4; +pub(in crate::state) const RULES: u64 = 4; /// The most a kept scan inflates to: the longest list, whose every row is under 256 bytes. const MOST_BYTES: usize = MAX_ROWS * 256; @@ -22,12 +22,12 @@ const MOST_BYTES: usize = MAX_ROWS * 256; // ponytail: the scan of an archive since moved or deleted stays there; a sweep of the files whose // archive is gone, if the folder ever grows large. fn folder() -> Option { - super::prefs::config_root().map(|root| root.join("gta6_scans")) + crate::state::prefs::config_root().map(|root| root.join("gta6_scans")) } /// Where the scan of one archive is kept, and the archive it is a scan of. #[derive(Clone)] -pub(super) struct Kept { +pub(in crate::state) struct Kept { file: PathBuf, /// What a kept scan starts with: this file's version and the scan's rules, then the archive's size, modification time and path. of: Vec, @@ -140,7 +140,7 @@ impl Kept { } /// The next eight bytes of `bytes` as a number, which moves past them. -pub(super) fn word(bytes: &mut &[u8]) -> io::Result { +pub(in crate::state) fn word(bytes: &mut &[u8]) -> io::Result { let mut word = [0; 8]; bytes.read_exact(&mut word)?; Ok(u64::from_le_bytes(word)) diff --git a/src/state/rpf9_list.rs b/src/state/rpf/rpf9_list.rs similarity index 99% rename from src/state/rpf9_list.rs rename to src/state/rpf/rpf9_list.rs index fdeec944f..1903ea693 100644 --- a/src/state/rpf9_list.rs +++ b/src/state/rpf/rpf9_list.rs @@ -5,7 +5,7 @@ use std::collections::{BTreeMap, BTreeSet}; use or_io::container::rpf::Rpf9Family; -use super::rpf9_scan::Row; +use crate::state::rpf9_scan::Row; /// A family of rows the list's toggles show or hide. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] diff --git a/src/state/gta6_script_view.rs b/src/state/rpf/rpf9_scan/ciphered/gta6_script_view.rs similarity index 100% rename from src/state/gta6_script_view.rs rename to src/state/rpf/rpf9_scan/ciphered/gta6_script_view.rs diff --git a/src/state/rpf9_scan_ciphered.rs b/src/state/rpf/rpf9_scan/ciphered/mod.rs similarity index 96% rename from src/state/rpf9_scan_ciphered.rs rename to src/state/rpf/rpf9_scan/ciphered/mod.rs index a88d91c33..8e3219601 100644 --- a/src/state/rpf9_scan_ciphered.rs +++ b/src/state/rpf/rpf9_scan/ciphered/mod.rs @@ -10,17 +10,17 @@ fn decrypted_payload(path: &Path, bytes: Vec) -> DocPayload { if bytes.starts_with(b"PSIN") || bytes.starts_with(b"RBF0") { return DocPayload::Meta(MetaDocument::from_bytes(bytes)); } - if super::super::document_io::is_text(&bytes) { + if crate::state::document_io::is_text(&bytes) { return super::gta6_data_xml::payload(path, bytes); } // A program the decompiler reads opens as its source; the listing takes one only it reads. - if let Some(script) = super::super::document::gta6_script::sniffed(&bytes) { + if let Some(script) = crate::state::document::gta6_script::sniffed(&bytes) { return script; } if let Some(listing) = gta6_script_view::script_payload(&bytes) { return listing; } - let banner = super::super::document_io::no_reader(path); + let banner = crate::state::document_io::no_reader(path); DocPayload::Hex(HexDocument { bytes, banner }) } @@ -61,7 +61,6 @@ pub(super) fn take_ciphered(path: &Path) -> Option { /// Decipher and inflate the content-ciphered leaf `entry_index` of the archive whose header is at /// `base` in the file at `archive`, loading the GTA VI key snapshot for the decipher. A test helper: /// the open path takes the stored bytes once through [`ciphered_payload`] instead. -#[path = "gta6_script_view.rs"] pub(super) mod gta6_script_view; #[cfg(test)] diff --git a/src/state/extracting_a_gta_vi_body.rs b/src/state/rpf/rpf9_scan/extracting_a_gta_vi_body.rs similarity index 100% rename from src/state/extracting_a_gta_vi_body.rs rename to src/state/rpf/rpf9_scan/extracting_a_gta_vi_body.rs diff --git a/src/state/gta6_data_xml.rs b/src/state/rpf/rpf9_scan/gta6_data_xml.rs similarity index 100% rename from src/state/gta6_data_xml.rs rename to src/state/rpf/rpf9_scan/gta6_data_xml.rs diff --git a/src/state/rpf9_scan.rs b/src/state/rpf/rpf9_scan/mod.rs similarity index 89% rename from src/state/rpf9_scan.rs rename to src/state/rpf/rpf9_scan/mod.rs index ae6e7cdb2..180d1fddc 100644 --- a/src/state/rpf9_scan.rs +++ b/src/state/rpf/rpf9_scan/mod.rs @@ -14,11 +14,11 @@ use or_io::container::rpf::{ }; use or_job::{Cancel, Progress}; -use super::document::{DocPayload, HexDocument, MetaDocument}; -use super::extract_job::{run_extraction, ExtractItem, OnClash}; -use super::jobs::{file_name, JobKind, RunningJob}; -use super::rpf9_counted_names::counted_scan; -use super::rpf9_kept::Kept; +use crate::state::document::{DocPayload, HexDocument, MetaDocument}; +use crate::state::extract_job::{run_extraction, ExtractItem, OnClash}; +use crate::state::jobs::{file_name, JobKind, RunningJob}; +use crate::state::rpf9_counted_names::counted_scan; +use crate::state::rpf9_kept::Kept; /// What one pass of the worker scans before it publishes its rows and looks for a stop. /// @@ -28,7 +28,7 @@ const SLICE: u64 = 64 << 20; /// The most a body opened from the list inflates to. const BODY_LIMIT: u64 = 1 << 30; /// The most rows a scan keeps: a body can be 16 bytes, so a file of them would hold a row per 16 bytes. -pub(super) const MAX_ROWS: usize = 1 << 20; +pub(in crate::state) const MAX_ROWS: usize = 1 << 20; /// Said of a body opened from a scan, which no save writes back into its archive. pub(crate) const READ_ONLY_BODY: &str = tr_key!( @@ -89,7 +89,9 @@ impl Found { } } -pub use super::rpf9_list::{row_at_offset, rows_between, rows_to_extract, ListFilter, RowKind}; +pub use crate::state::rpf9_list::{ + row_at_offset, rows_between, rows_to_extract, ListFilter, RowKind, +}; pub struct Rpf9ScanDocument { /// The archive file; a nested archive's offsets are this file's. @@ -103,7 +105,7 @@ pub struct Rpf9ScanDocument { progress: Progress, found: Arc>, /// The read of an effect container the list opened, which stops when the archive closes. - effects: Mutex>, + effects: Mutex>, /// Which rows the list shows, and where it last jumped to. list: Mutex, /// Where the scan is kept once it has read the whole archive; `None` for a nested archive's. @@ -278,7 +280,7 @@ fn lock(found: &Mutex) -> MutexGuard<'_, Found> { /// Scan the file from `start` a slice at a time, publishing each slice's rows, until it ends or is /// stopped; a scan from a nested archive's header ends with that archive's names. -pub(super) fn scan( +pub(in crate::state) fn scan( path: &Path, start: u64, len: u64, @@ -383,31 +385,24 @@ pub(super) fn scan( } #[cfg(test)] -#[path = "extracting_a_gta_vi_body.rs"] mod extracting_a_gta_vi_body; -#[path = "rpf9_scan_view.rs"] mod view; use view::not_a_start; pub use view::{view_of, View}; -#[path = "rpf9_table.rs"] pub(crate) mod rpf9_table; -#[path = "rpf9_scan_ciphered.rs"] mod ciphered; #[cfg(test)] pub(crate) use ciphered::decipher_entry; use ciphered::{ciphered_payload, take_ciphered}; pub(crate) use ciphered::{forget_ciphered, remember_ciphered}; -#[path = "rpf9_scan_payload.rs"] mod payload; use payload::body_payload; -#[path = "gta6_data_xml.rs"] pub(crate) mod gta6_data_xml; -#[path = "rpf9_tree_actions.rs"] pub(crate) mod rpf9_tree_actions; /// The path a body at `offset` of `archive` opens under in `view`. @@ -420,8 +415,8 @@ pub fn body_path(archive: &Path, offset: u64, view: View) -> PathBuf { pub fn scanned_body(path: &Path) -> Option<(&Path, u64)> { archived_body(path).or_else(|| { // A GTA VI `.zmt` can be an RBM resource as its archive stores it. - let kind = super::DocumentKind::from_path(path); - if kind.is_some_and(|k| k != super::DocumentKind::Meta) { + let kind = crate::state::DocumentKind::from_path(path); + if kind.is_some_and(|k| k != crate::state::DocumentKind::Meta) { return None; } let mut head = Vec::with_capacity(LOOSE_HEAD as usize); @@ -460,11 +455,15 @@ fn is_missing(head: &[u8]) -> bool { } /// The body a path [`body_path`] made names, read and given to the view its kind has, or kept as its bytes where no reader reads it. -pub(super) fn read_body(path: &Path, archive: &Path, offset: u64) -> Result { +pub(in crate::state) fn read_body( + path: &Path, + archive: &Path, + offset: u64, +) -> Result { // A body opened anew holds none of the edits a closed document of it kept, through either door. - super::gta6_gltf_import::forget(path); - super::gta6_embedded_edit::forget(path); - super::gta6_modding::model_replace::forget(path); + crate::state::gta6_gltf_import::forget(path); + crate::state::gta6_embedded_edit::forget(path); + crate::state::gta6_modding::model_replace::forget(path); // A content-ciphered entry the archive explorer opened left a decrypt request here, keyed by // this synthetic path; the decipher runs on this worker, not the UI thread. The clear reader // below reads only bytes stored in the clear. @@ -472,8 +471,8 @@ pub(super) fn read_body(path: &Path, archive: &Path, offset: u64) -> Result { origins().insert(path.to_path_buf(), (find, false)); @@ -488,14 +487,16 @@ pub(super) fn read_body(path: &Path, archive: &Path, offset: u64) -> Result match super::gta6_first_entry::opened(archive, &file, offset, BODY_LIMIT, &e) { - Some(opened) => { - let (find, hex) = opened?; - origins().insert(path.to_path_buf(), (find, false)); - return Ok(DocPayload::Hex(hex)); + Err(e) => { + match crate::state::gta6_first_entry::opened(archive, &file, offset, BODY_LIMIT, &e) { + Some(opened) => { + let (find, hex) = opened?; + origins().insert(path.to_path_buf(), (find, false)); + return Ok(DocPayload::Hex(hex)); + } + None => return Err(e.to_string()), } - None => return Err(e.to_string()), - }, + } Ok(read) => read, }; origins().insert(path.to_path_buf(), (find, path == archive)); @@ -545,7 +546,7 @@ pub(crate) fn opened_as_text(path: &Path) -> bool { } /// Whether the Text panel keeps `doc` from edits: a scanned body takes them only as its own text. -pub(crate) fn text_takes_no_edit(doc: &super::Document) -> bool { +pub(crate) fn text_takes_no_edit(doc: &crate::state::Document) -> bool { doc.read_only.is_some_and(|why| { why != READ_ONLY_BODY || !doc.path.as_deref().is_some_and(opened_as_text) }) @@ -597,8 +598,8 @@ fn headerless(path: &Path, resource: &Rpf9Resource, bytes: &[u8]) -> Result Result Option { + pub fn scan_listing_the_active_tab(&self) -> Option { let active = self.active_document()?; if matches!(active.payload, DocPayload::Rpf9(_)) { return Some(active.id); @@ -638,31 +639,35 @@ impl super::AppState { /// The offset of the row of `scan`'s list on screen: the one selected in its own tab, or the /// body of it the tab on screen shows. - pub fn scan_row_on_screen(&self, scan: super::DocumentId) -> Option { + pub fn scan_row_on_screen(&self, scan: crate::state::DocumentId) -> Option { let active = self.active_document()?; if active.id == scan { return self .selection .selected(scan) - .and_then(super::SelectionKey::row); + .and_then(crate::state::SelectionKey::row); } let stem = active.path.as_deref()?.file_stem()?.to_str()?; u64::from_str_radix(stem.strip_prefix("0x")?, 16).ok() } /// Open row `row` of the scan document `doc` shows, read-only in the view its kind has or as its bytes, or say why it does not open. - pub fn open_scanned_body(&mut self, doc: super::DocumentId, row: usize) { + pub fn open_scanned_body(&mut self, doc: crate::state::DocumentId, row: usize) { self.open_scanned(doc, row, false); } /// As [`Self::open_scanned_body`], in the preview tab: the next row previewed takes its place. - pub fn preview_scanned_row(&mut self, doc: super::DocumentId, row: usize) { + pub fn preview_scanned_row(&mut self, doc: crate::state::DocumentId, row: usize) { self.open_scanned(doc, row, true); } /// Show the body at `offset` of the scan document `doc` in the preview tab, as a step of history /// to its row does; nothing for a document of any other kind. - pub(super) fn show_scanned_row(&mut self, doc: super::DocumentId, offset: u64) { + pub(in crate::state) fn show_scanned_row( + &mut self, + doc: crate::state::DocumentId, + offset: u64, + ) { let Some(DocPayload::Rpf9(scan)) = self.document(doc).map(|d| &d.payload) else { return; }; @@ -676,7 +681,7 @@ impl super::AppState { } } - fn open_scanned(&mut self, doc: super::DocumentId, row: usize, preview: bool) { + fn open_scanned(&mut self, doc: crate::state::DocumentId, row: usize, preview: bool) { let Some(DocPayload::Rpf9(scan)) = self.document(doc).map(|d| &d.payload) else { return; }; @@ -686,7 +691,7 @@ impl super::AppState { let Some(Row::Body(find)) = found.rows.get(row).cloned() else { return; }; - let ended = super::gta6_first_entry::note(&scan.path, &found, &find); + let ended = crate::state::gta6_first_entry::note(&scan.path, &found, &find); let view = match found.view(&find) { // Its tab says why no reader fits it, so its row raises no toast. Err(_) if opens_as_bytes(&find) && ended => Ok(View::Bytes), @@ -697,7 +702,7 @@ impl super::AppState { match view { // A nested archive's list is where its bodies open from, so its tab is kept. Ok(View::Archive) => { - super::rpf9_counted_names::remember(&scan.path, &scan.found(), find.offset); + crate::state::rpf9_counted_names::remember(&scan.path, &scan.found(), find.offset); self.load_file(body_path(&scan.path, find.offset, View::Archive)) } Ok(view) => { @@ -708,13 +713,13 @@ impl super::AppState { } let path = body_path(&scan.path, find.offset, view); // A step of history to its row shows the body again. - let row = super::navigation::Location { + let row = crate::state::navigation::Location { doc, - node: super::SelectionKey::Row(find.offset), + node: crate::state::SelectionKey::Row(find.offset), }; self.navigation.visit(row); self.selection - .select(doc, super::SelectionKey::Row(find.offset)); + .select(doc, crate::state::SelectionKey::Row(find.offset)); self.open_scanned_path(path, preview); } Err(why) => self.show_info_toast(why), @@ -723,12 +728,12 @@ impl super::AppState { } /// The body at `offset` of `archive` as [`extract_rpf9_body`] writes a file of it. -pub(super) fn extracted_body(archive: &Path, offset: u64) -> Result, String> { +pub(in crate::state) fn extracted_body(archive: &Path, offset: u64) -> Result, String> { let file = File::open(archive).map_err(|e| format!("{}: {e}", archive.display()))?; extract_rpf9_body(&file, offset, BODY_LIMIT) .map(|(_, bytes)| bytes) .or_else(|e| { - super::gta6_first_entry::bytes(archive, &file, offset, BODY_LIMIT, &e) + crate::state::gta6_first_entry::bytes(archive, &file, offset, BODY_LIMIT, &e) .unwrap_or_else(|| Err(e.to_string())) }) } @@ -747,12 +752,12 @@ pub fn opens_as_bytes(find: &Rpf9ScanFind) -> bool { extracts(find) && !matches!(find.kind, Rpf9BodyKind::Sgd5 { .. }) } -impl super::AppState { +impl crate::state::AppState { /// Extract rows `rows` of the scan document `doc` into `dest` on a worker, each a file that /// opens again, named by its offset and kind; `false` when nothing started. pub fn extract_scanned_bodies( &mut self, - doc: super::DocumentId, + doc: crate::state::DocumentId, rows: &[usize], dest: PathBuf, ) -> bool { @@ -765,7 +770,7 @@ impl super::AppState { // A nested archive ends with its names row; the names themselves have no end. let ends = |find: &Rpf9ScanFind| { !matches!(find.kind, Rpf9BodyKind::Names { .. }) - && super::gta6_first_entry::note(&scan.path, &found, find) + && crate::state::gta6_first_entry::note(&scan.path, &found, find) }; (rows.iter()) .filter_map(|row| match found.rows.get(*row) { @@ -783,9 +788,9 @@ impl super::AppState { return false; } match self.gate_permits(Some(&dest)) { - super::GateOutcome::Proceed => {} - super::GateOutcome::Refused => return false, - super::GateOutcome::Confirm(_) => { + crate::state::GateOutcome::Proceed => {} + crate::state::GateOutcome::Refused => return false, + crate::state::GateOutcome::Confirm(_) => { self.show_warning_toast(tr!("Extract into a folder outside the game's install.")); return false; } @@ -801,7 +806,7 @@ impl super::AppState { } /// Write `items` read out of `archive` into `dest` as the one extraction, on a worker. - pub(super) fn start_scanned_extraction( + pub(in crate::state) fn start_scanned_extraction( &mut self, label: String, dest: PathBuf, @@ -843,8 +848,8 @@ impl super::AppState { impl Rpf9ScanDocument { /// Read the effects of the `SGD5` container `find` on a worker, in place of any read before it. - pub(super) fn read_effects(&self, find: Rpf9ScanFind) { - *self.effects() = Some(super::gta6_effects::EffectsRead::start( + pub(in crate::state) fn read_effects(&self, find: Rpf9ScanFind) { + *self.effects() = Some(crate::state::gta6_effects::EffectsRead::start( &self.path, find, BODY_LIMIT, )); } @@ -854,21 +859,23 @@ impl Rpf9ScanDocument { self.effects().as_ref()?.job() } - pub(super) fn stop_effects(&self) { + pub(in crate::state) fn stop_effects(&self) { if let Some(read) = self.effects().as_ref() { read.stop(); } } /// How the effects read ended, once, and the read dropped. - pub(super) fn effects_ended(&self) -> Option { + pub(in crate::state) fn effects_ended( + &self, + ) -> Option { let mut read = self.effects(); let ended = read.as_ref()?.ended()?; *read = None; Some(ended) } - fn effects(&self) -> MutexGuard<'_, Option> { + fn effects(&self) -> MutexGuard<'_, Option> { (self.effects.lock()).unwrap_or_else(|poisoned| poisoned.into_inner()) } } @@ -879,7 +886,8 @@ type Skeleton = or_io::gta6::headerless::Skeleton; // ponytail: one map for the whole app, which no close empties; skeletons are small. static SKELETONS: Mutex>> = Mutex::new(BTreeMap::new()); -pub(super) fn skeletons() -> MutexGuard<'static, BTreeMap>> { +pub(in crate::state) fn skeletons( +) -> MutexGuard<'static, BTreeMap>> { (SKELETONS.lock()).unwrap_or_else(|poisoned| poisoned.into_inner()) } diff --git a/src/state/rpf9_scan_payload.rs b/src/state/rpf/rpf9_scan/payload.rs similarity index 99% rename from src/state/rpf9_scan_payload.rs rename to src/state/rpf/rpf9_scan/payload.rs index 50ff1c8e6..0eb2716fa 100644 --- a/src/state/rpf9_scan_payload.rs +++ b/src/state/rpf/rpf9_scan/payload.rs @@ -1,12 +1,12 @@ //! The one step from a body a scan of a GTA VI archive found to the payload its view opens, taken //! by the clear read and by the deciphered read of a content-ciphered entry alike. -use super::super::{ +use super::*; +use crate::state::{ document_io, gta6_dialogue, gta6_effect_facts, gta6_entry_skeletons, gta6_face, gta6_head, gta6_name_pool, gta6_other_bodies, gta6_particles, gta6_resource, gta6_text, gta6_weapon_parts, ttpf_document, }; -use super::*; /// What `bytes`, the body `find` of `archive`, open as under `path`: its view's read, else its bytes. pub(super) fn body_payload( @@ -134,7 +134,7 @@ pub(super) fn body_payload( label, extension: Some(if fragment { "#ft" } else { "#dr" }), }; - super::super::gta6_learned_names::learn( + crate::state::gta6_learned_names::learn( archive, find.offset, kind, diff --git a/src/state/gta6_archive_save.rs b/src/state/rpf/rpf9_scan/rpf9_table/gta6_archive_save/mod.rs similarity index 99% rename from src/state/gta6_archive_save.rs rename to src/state/rpf/rpf9_scan/rpf9_table/gta6_archive_save/mod.rs index 1f4c733f9..f30b6757e 100644 --- a/src/state/gta6_archive_save.rs +++ b/src/state/rpf/rpf9_scan/rpf9_table/gta6_archive_save/mod.rs @@ -443,5 +443,4 @@ fn replaced( } #[cfg(test)] -#[path = "gta6_archive_save_tests.rs"] mod tests; diff --git a/src/state/gta6_archive_save_tests.rs b/src/state/rpf/rpf9_scan/rpf9_table/gta6_archive_save/tests.rs similarity index 100% rename from src/state/gta6_archive_save_tests.rs rename to src/state/rpf/rpf9_scan/rpf9_table/gta6_archive_save/tests.rs diff --git a/src/state/gta6_keys_flow.rs b/src/state/rpf/rpf9_scan/rpf9_table/gta6_keys_flow.rs similarity index 100% rename from src/state/gta6_keys_flow.rs rename to src/state/rpf/rpf9_scan/rpf9_table/gta6_keys_flow.rs diff --git a/src/state/gta6_keys_held.rs b/src/state/rpf/rpf9_scan/rpf9_table/gta6_keys_held.rs similarity index 100% rename from src/state/gta6_keys_held.rs rename to src/state/rpf/rpf9_scan/rpf9_table/gta6_keys_held.rs diff --git a/src/state/rpf9_table.rs b/src/state/rpf/rpf9_scan/rpf9_table/mod.rs similarity index 98% rename from src/state/rpf9_table.rs rename to src/state/rpf/rpf9_scan/rpf9_table/mod.rs index 364682e10..b85d679ae 100644 --- a/src/state/rpf9_table.rs +++ b/src/state/rpf/rpf9_scan/rpf9_table/mod.rs @@ -179,14 +179,10 @@ impl crate::state::AppState { } } -#[path = "gta6_keys_held.rs"] pub(crate) mod gta6_keys_held; -#[path = "gta6_keys_flow.rs"] pub(crate) mod gta6_keys_flow; -#[path = "rpf9_names_cache.rs"] mod names_cache; -#[path = "gta6_archive_save.rs"] mod gta6_archive_save; diff --git a/src/state/rpf9_names_cache.rs b/src/state/rpf/rpf9_scan/rpf9_table/names_cache.rs similarity index 100% rename from src/state/rpf9_names_cache.rs rename to src/state/rpf/rpf9_scan/rpf9_table/names_cache.rs diff --git a/src/state/rpf9_tree_actions.rs b/src/state/rpf/rpf9_scan/rpf9_tree_actions.rs similarity index 100% rename from src/state/rpf9_tree_actions.rs rename to src/state/rpf/rpf9_scan/rpf9_tree_actions.rs diff --git a/src/state/rpf9_scan_view.rs b/src/state/rpf/rpf9_scan/view.rs similarity index 100% rename from src/state/rpf9_scan_view.rs rename to src/state/rpf/rpf9_scan/view.rs diff --git a/src/state/rpf_archive_open.rs b/src/state/rpf/rpf_archive_open/mod.rs similarity index 79% rename from src/state/rpf_archive_open.rs rename to src/state/rpf/rpf_archive_open/mod.rs index 528e8aee1..c196c1cd0 100644 --- a/src/state/rpf_archive_open.rs +++ b/src/state/rpf/rpf_archive_open/mod.rs @@ -15,24 +15,26 @@ pub fn open_archive_from_disk( }; let opened = RpfArchive::open_with(path, crypto); opened.map(Arc::new).map_err(|e| { - super::gta_vi::rpf9_unopened_at(path, &e) + crate::state::gta_vi::rpf9_unopened_at(path, &e) .unwrap_or_else(|| format!("open '{}': {e}", path.display())) }) } /// A GTA VI archive on disk as the tree every archive opens as, read entry by entry from its file; `None` for any other file, with no key, and, said in a toast, where it does not open. -pub(super) fn gta6_tree(path: &Path) -> Option { +pub(in crate::state) fn gta6_tree(path: &Path) -> Option { if !is_rpf9(path) { return None; } let crypto = gta6_crypto(path)?; let opened = RpfArchive::open_with(path, crypto) - .map_err(|e| super::gta_vi::rpf9_unopened_at(path, &e).unwrap_or_else(|| e.to_string())) - .and_then(super::rpf_session::RpfDocument::new); + .map_err(|e| { + crate::state::gta_vi::rpf9_unopened_at(path, &e).unwrap_or_else(|| e.to_string()) + }) + .and_then(crate::state::rpf_session::RpfDocument::new); match opened { - Ok(tree) => Some(super::DocPayload::Rpf(tree)), + Ok(tree) => Some(crate::state::DocPayload::Rpf(tree)), Err(why) => { - super::rpf9_scan::rpf9_table::offer_unopened(path, why); + crate::state::rpf9_scan::rpf9_table::offer_unopened(path, why); None } } @@ -52,14 +54,14 @@ fn is_rpf9(path: &Path) -> bool { /// handed; `None` when the app holds no keys, so the archive is refused rather than read. // ⚠ Waits until the names are built, so it is reached only from a load's or a tree row's worker, // whose loading row shows meanwhile. -pub(super) fn gta6_crypto(path: &Path) -> Option> { +pub(in crate::state) fn gta6_crypto(path: &Path) -> Option> { use or_io::container::rpf::Gta6Context; // The keys are those of the build whose platform letter the archive's header states at 0x19. let platform = or_io::container::rpf::rpf9_platform_of(path); - let keys = super::rpf9_scan::rpf9_table::keys_of(platform).ok()?; + let keys = crate::state::rpf9_scan::rpf9_table::keys_of(platform).ok()?; Some(Arc::new(Gta6Context { keys, - names: super::rpf9_scan::rpf9_table::resolver(), + names: crate::state::rpf9_scan::rpf9_table::resolver(), })) } @@ -106,24 +108,22 @@ pub(crate) mod gta6_session { } } -#[path = "rpf9_tree_open.rs"] -pub(super) mod tree_open; +pub(crate) mod tree_open; -#[path = "rpf9_tree_verbs.rs"] -pub(super) mod tree_verbs; +pub(crate) mod tree_verbs; -impl super::AppState { +impl crate::state::AppState { /// Opens an entry of a GTA VI archive by what its body is, read by its table row on the load worker, since its name states no kind; `false` for any other entry. - pub(super) fn open_gta6_archive_entry( + pub(in crate::state) fn open_gta6_archive_entry( &mut self, - parent: super::DocumentId, - entry: super::RpfNodeId, + parent: crate::state::DocumentId, + entry: crate::state::RpfNodeId, ) -> bool { let place = (|| { - let super::DocPayload::Rpf(rpf) = &self.document(parent)?.payload else { + let crate::state::DocPayload::Rpf(rpf) = &self.document(parent)?.payload else { return None; }; - let super::RpfNodeBacking::ArchiveFile { + let crate::state::RpfNodeBacking::ArchiveFile { archive_id, entry_index, override_bytes, @@ -139,13 +139,13 @@ impl super::AppState { let Some((place, row_start, edited)) = place else { return false; }; - let view = super::rpf9_scan::View::Bytes; - let path = super::rpf9_scan::body_path(&place.file, place.offset, view); + let view = crate::state::rpf9_scan::View::Bytes; + let path = crate::state::rpf9_scan::body_path(&place.file, place.offset, view); tree_open::leave( &path, &place, row_start, - super::rpf9_scan::rpf9_table::keys, + crate::state::rpf9_scan::rpf9_table::keys, edited, ); tree_open::name(self, &path, parent, entry); diff --git a/src/state/rpf9_tree_bind.rs b/src/state/rpf/rpf_archive_open/tree_open/bind/mod.rs similarity index 99% rename from src/state/rpf9_tree_bind.rs rename to src/state/rpf/rpf_archive_open/tree_open/bind/mod.rs index 4c48532c0..1fcc8aaad 100644 --- a/src/state/rpf9_tree_bind.rs +++ b/src/state/rpf/rpf_archive_open/tree_open/bind/mod.rs @@ -167,5 +167,4 @@ impl AppState { } #[cfg(test)] -#[path = "rpf9_tree_bind_tests.rs"] mod tests; diff --git a/src/state/rpf9_tree_bind_tests.rs b/src/state/rpf/rpf_archive_open/tree_open/bind/tests.rs similarity index 100% rename from src/state/rpf9_tree_bind_tests.rs rename to src/state/rpf/rpf_archive_open/tree_open/bind/tests.rs diff --git a/src/state/rpf9_tree_open.rs b/src/state/rpf/rpf_archive_open/tree_open/mod.rs similarity index 99% rename from src/state/rpf9_tree_open.rs rename to src/state/rpf/rpf_archive_open/tree_open/mod.rs index a81d1b9fd..4caf64144 100644 --- a/src/state/rpf9_tree_open.rs +++ b/src/state/rpf/rpf_archive_open/tree_open/mod.rs @@ -266,11 +266,9 @@ fn by_head(path: &Path, bytes: Vec) -> DocPayload { DocPayload::Hex(HexDocument { bytes, banner }) } -#[path = "rpf9_tree_bind.rs"] mod bind; #[cfg(test)] -#[path = "rpf9_tree_open_names_tests.rs"] mod names_tests; #[cfg(test)] diff --git a/src/state/rpf9_tree_open_names_tests.rs b/src/state/rpf/rpf_archive_open/tree_open/names_tests.rs similarity index 100% rename from src/state/rpf9_tree_open_names_tests.rs rename to src/state/rpf/rpf_archive_open/tree_open/names_tests.rs diff --git a/src/state/rpf9_archive_size_tests.rs b/src/state/rpf/rpf_archive_open/tree_verbs/adopt/archive_size_tests.rs similarity index 100% rename from src/state/rpf9_archive_size_tests.rs rename to src/state/rpf/rpf_archive_open/tree_verbs/adopt/archive_size_tests.rs diff --git a/src/state/rpf9_tree_adopt.rs b/src/state/rpf/rpf_archive_open/tree_verbs/adopt/mod.rs similarity index 99% rename from src/state/rpf9_tree_adopt.rs rename to src/state/rpf/rpf_archive_open/tree_verbs/adopt/mod.rs index 579f341c3..59c7d82ad 100644 --- a/src/state/rpf9_tree_adopt.rs +++ b/src/state/rpf/rpf_archive_open/tree_verbs/adopt/mod.rs @@ -246,9 +246,7 @@ fn adopt( } #[cfg(test)] -#[path = "rpf9_tree_adopt_tests.rs"] mod tests; #[cfg(test)] -#[path = "rpf9_archive_size_tests.rs"] mod archive_size_tests; diff --git a/src/state/rpf9_tree_adopt_tests.rs b/src/state/rpf/rpf_archive_open/tree_verbs/adopt/tests.rs similarity index 100% rename from src/state/rpf9_tree_adopt_tests.rs rename to src/state/rpf/rpf_archive_open/tree_verbs/adopt/tests.rs diff --git a/src/state/rpf9_tree_headerless_tests.rs b/src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/mod.rs similarity index 99% rename from src/state/rpf9_tree_headerless_tests.rs rename to src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/mod.rs index 97bc1dfd7..b63c97d45 100644 --- a/src/state/rpf9_tree_headerless_tests.rs +++ b/src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/mod.rs @@ -145,5 +145,4 @@ fn a_real_text_tables_first_text_changed_at_its_length_saves_as_a_patched_copy() assert_eq!(Some(read), stored_body(&loose)); } -#[path = "gta6_app_saves_per_kind_tests.rs"] pub(crate) mod saves_per_kind; diff --git a/src/state/gta6_app_saves_per_kind_edits.rs b/src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/edits.rs similarity index 100% rename from src/state/gta6_app_saves_per_kind_edits.rs rename to src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/edits.rs diff --git a/src/state/gta6_app_saves_per_kind_tests.rs b/src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/mod.rs similarity index 99% rename from src/state/gta6_app_saves_per_kind_tests.rs rename to src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/mod.rs index dcca1adfe..f82387871 100644 --- a/src/state/gta6_app_saves_per_kind_tests.rs +++ b/src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/mod.rs @@ -35,11 +35,8 @@ use read_back::copied; pub(crate) use read_back::overlaid; use rows::{ranked, spread, Row}; -#[path = "gta6_app_saves_per_kind_edits.rs"] mod edits; -#[path = "gta6_app_saves_per_kind_read_back.rs"] mod read_back; -#[path = "gta6_app_saves_per_kind_rows.rs"] mod rows; const WHAT: &str = "every kind the app edits saved through its tree row of the build"; diff --git a/src/state/gta6_app_saves_per_kind_read_back.rs b/src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/read_back.rs similarity index 100% rename from src/state/gta6_app_saves_per_kind_read_back.rs rename to src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/read_back.rs diff --git a/src/state/gta6_app_saves_per_kind_rows.rs b/src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/rows.rs similarity index 100% rename from src/state/gta6_app_saves_per_kind_rows.rs rename to src/state/rpf/rpf_archive_open/tree_verbs/headerless_tests/saves_per_kind/rows.rs diff --git a/src/state/rpf9_tree_verbs.rs b/src/state/rpf/rpf_archive_open/tree_verbs/mod.rs similarity index 99% rename from src/state/rpf9_tree_verbs.rs rename to src/state/rpf/rpf_archive_open/tree_verbs/mod.rs index f3128670f..1e87c7571 100644 --- a/src/state/rpf9_tree_verbs.rs +++ b/src/state/rpf/rpf_archive_open/tree_verbs/mod.rs @@ -980,16 +980,12 @@ impl AppState { } } -#[path = "rpf9_tree_adopt.rs"] mod adopt; -#[path = "rpf9_tree_plan_job.rs"] pub(crate) mod plan_job; #[cfg(test)] -#[path = "rpf9_tree_verbs_tests.rs"] pub(crate) mod tests; #[cfg(test)] -#[path = "rpf9_tree_headerless_tests.rs"] pub(crate) mod headerless_tests; diff --git a/src/state/rpf9_tree_plan_job.rs b/src/state/rpf/rpf_archive_open/tree_verbs/plan_job.rs similarity index 100% rename from src/state/rpf9_tree_plan_job.rs rename to src/state/rpf/rpf_archive_open/tree_verbs/plan_job.rs diff --git a/src/state/rpf9_tree_verbs_tests.rs b/src/state/rpf/rpf_archive_open/tree_verbs/tests.rs similarity index 100% rename from src/state/rpf9_tree_verbs_tests.rs rename to src/state/rpf/rpf_archive_open/tree_verbs/tests.rs diff --git a/src/state/rpf_expansion.rs b/src/state/rpf/rpf_expansion.rs similarity index 97% rename from src/state/rpf_expansion.rs rename to src/state/rpf/rpf_expansion.rs index a6554a91d..a269a4d78 100644 --- a/src/state/rpf_expansion.rs +++ b/src/state/rpf/rpf_expansion.rs @@ -1,4 +1,4 @@ -use super::*; +use crate::state::*; impl AppState { pub fn request_expand(&mut self, doc_id: DocumentId, node_id: RpfNodeId) { @@ -13,7 +13,7 @@ impl AppState { } /// Open an archive row the tree has not expanded, as expanding it does, so what is added to it reaches it. - pub(super) fn open_archive_row( + pub(in crate::state) fn open_archive_row( &mut self, doc_id: DocumentId, node_id: RpfNodeId, @@ -23,7 +23,7 @@ impl AppState { else { return Ok(()); }; - match super::expander::open_archive(source, crypto) { + match crate::state::expander::open_archive(source, crypto) { Ok(resolved) => { self.apply_archive_open(doc_id, node_id, resolved); Ok(()) @@ -35,7 +35,7 @@ impl AppState { } } - pub(super) fn build_expansion_request( + pub(in crate::state) fn build_expansion_request( &self, doc_id: DocumentId, node_id: RpfNodeId, @@ -112,7 +112,7 @@ impl AppState { } // A GTA VI archive is refused by design and opens as a scan: the status // bar counts no warning for it. - Err(error) if super::gta_vi::is_rpf9_refusal(&error) => { + Err(error) if crate::state::gta_vi::is_rpf9_refusal(&error) => { tracing::debug!(%doc_id, %node_id, "A GTA VI archive lists no entry"); self.mark_archive_open_failed(doc_id, node_id, error); } @@ -136,7 +136,7 @@ impl AppState { } } - pub(super) fn apply_disk_scan( + pub(in crate::state) fn apply_disk_scan( &mut self, doc_id: DocumentId, node_id: RpfNodeId, diff --git a/src/state/rpf_moves.rs b/src/state/rpf/rpf_moves.rs similarity index 88% rename from src/state/rpf_moves.rs rename to src/state/rpf/rpf_moves.rs index 6a071cc0f..ff07ea7e8 100644 --- a/src/state/rpf_moves.rs +++ b/src/state/rpf/rpf_moves.rs @@ -1,8 +1,8 @@ //! Rows moved or copied into a folder together, as a drag drops the selection: the edit gate asked //! once, and the moves or the copies one undo step. -use super::document::{DocumentId, RpfNodeId}; -use super::{AppState, DocPayload, GateOutcome, PendingRetailEdit, PendingRetailEditPrompt}; +use crate::state::document::{DocumentId, RpfNodeId}; +use crate::state::{AppState, DocPayload, GateOutcome, PendingRetailEdit, PendingRetailEditPrompt}; impl AppState { /// Move `rows` of `doc` into the row `folder`, asking the edit gate once for every archive or folder the moves write. @@ -29,7 +29,7 @@ impl AppState { let mut ask = None; for target in targets { match self.gate_permits(target.as_deref()) { - GateOutcome::Refused => return Err(super::retail_pending_message()), + GateOutcome::Refused => return Err(crate::state::retail_pending_message()), GateOutcome::Confirm(path) => ask = ask.or(Some(path)), GateOutcome::Proceed => {} } @@ -44,7 +44,7 @@ impl AppState { target_path, verb: "move", }); - return Err(super::retail_pending_message()); + return Err(crate::state::retail_pending_message()); } self.rpf_move_nodes_inner(doc, &rows, folder) } @@ -64,10 +64,10 @@ impl AppState { return Err(tr!("The archive is no longer open").into()); }; // ⚠ Held before anything is written into it, so a copy that fails on the way leaves nothing - let staged = super::pending_prompts::Staged::new(super::clipboard::staging_dir( - "openrage-clipboard", - )); - let files = super::clipboard::files_of_rows(&rpf.session, &rows, staged.folder())?; + let staged = crate::state::pending_prompts::Staged::new( + crate::state::clipboard::staging_dir("openrage-clipboard"), + ); + let files = crate::state::clipboard::files_of_rows(&rpf.session, &rows, staged.folder())?; self.copy_paths_into_folder(doc, folder, files, staged); Ok(()) } @@ -76,7 +76,7 @@ impl AppState { /// /// ⚠ An `Err` for a row that would go into itself or a folder inside it, and for no row at all; /// `Ok` and empty when each of them is in `folder` already, which asks and writes nothing. - pub(super) fn rows_to_place( + pub(in crate::state) fn rows_to_place( &self, doc: DocumentId, rows: &[RpfNodeId], @@ -86,7 +86,7 @@ impl AppState { let Some(DocPayload::Rpf(rpf)) = self.document(doc).map(|d| &d.payload) else { return Err(tr!("The archive is no longer open").into()); }; - let rows = super::clipboard::top_rows(&rpf.session, rows); + let rows = crate::state::clipboard::top_rows(&rpf.session, rows); if rows.is_empty() { return Err(tr!("Select a file or folder to {verb}", verb = verb)); } @@ -107,7 +107,7 @@ impl AppState { } /// The moves, once the gate is satisfied: one row as a move of it alone, several as one undo step. - pub(super) fn rpf_move_nodes_inner( + pub(in crate::state) fn rpf_move_nodes_inner( &mut self, doc: DocumentId, rows: &[RpfNodeId], diff --git a/src/state/rpf_node.rs b/src/state/rpf/rpf_node.rs similarity index 97% rename from src/state/rpf_node.rs rename to src/state/rpf/rpf_node.rs index 467f802ac..ec732d666 100644 --- a/src/state/rpf_node.rs +++ b/src/state/rpf/rpf_node.rs @@ -4,8 +4,8 @@ use std::sync::Arc; use or_io::container::RpfArchive; -use super::document::{ArchiveId, RpfNodeId}; -use super::memory::hash_table_bytes; +use crate::state::document::{ArchiveId, RpfNodeId}; +use crate::state::memory::hash_table_bytes; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum RpfSessionNodeKind { @@ -178,7 +178,7 @@ impl ArchiveSlot { } } -impl super::rpf_session::RpfEditSession { +impl crate::state::rpf_session::RpfEditSession { /// Entry and archive bytes held in memory, the read cache among them; the tables of contents are `table_bytes`. pub fn held_bytes(&self) -> usize { let entries: usize = self diff --git a/src/state/rpf_records.rs b/src/state/rpf/rpf_records.rs similarity index 97% rename from src/state/rpf_records.rs rename to src/state/rpf/rpf_records.rs index 8ba4f518b..f94e89400 100644 --- a/src/state/rpf_records.rs +++ b/src/state/rpf/rpf_records.rs @@ -9,9 +9,9 @@ use std::sync::Arc; use or_io::container::rpf::{BodyForm, RpfArchive, RpfEntry}; -use super::document::{ArchiveId, RpfNodeId}; -use super::rpf_node::{ArchiveSource, RpfNodeBacking, RpfSessionNodeKind}; -use super::rpf_session::RpfEditSession; +use crate::state::document::{ArchiveId, RpfNodeId}; +use crate::state::rpf_node::{ArchiveSource, RpfNodeBacking, RpfSessionNodeKind}; +use crate::state::rpf_session::RpfEditSession; impl RpfEditSession { /// The bytes of the archive at `id`: its file on disk, or its entry in the archive around it. @@ -45,7 +45,7 @@ impl RpfEditSession { /// The files under `root` by their path below it, with each archive nested there as one file and each empty folder as its path and a `/`. /// /// ⚠ No file's path names an empty folder, so a rebuild without its record drops it. - pub(super) fn records_under( + pub(in crate::state) fn records_under( &self, root: RpfNodeId, ) -> Result, bool)>, String> { @@ -89,7 +89,7 @@ impl RpfEditSession { /// A nested archive as the archive holding it stores it: the bytes stored /// there, or once anything inside it was edited, a rebuild from its own /// records under the encryption it was read with. - pub(super) fn nested_archive_bytes(&self, id: RpfNodeId) -> Result, String> { + pub(in crate::state) fn nested_archive_bytes(&self, id: RpfNodeId) -> Result, String> { let node = self .nodes .get(&id) @@ -112,7 +112,7 @@ impl RpfEditSession { .filter(|slot| slot.dirty) { let records = self.records_under(id)?; - return super::document_io::archive_from_records( + return crate::state::document_io::archive_from_records( records, slot.archive.header.encryption, Arc::clone(&self.crypto), diff --git a/src/state/rpf_session.rs b/src/state/rpf/rpf_session.rs similarity index 98% rename from src/state/rpf_session.rs rename to src/state/rpf/rpf_session.rs index e4bb91381..d8bb0382b 100644 --- a/src/state/rpf_session.rs +++ b/src/state/rpf/rpf_session.rs @@ -8,9 +8,9 @@ use or_io::container::rpf::{BodyForm, RpfEntry}; use or_io::container::{NoOpCryptoProvider, RpfArchive, RpfCryptoProvider}; use or_title::vfs::{ArchiveDevice, ArchiveEntry, ArchiveEntryKind}; -use super::document::{ArchiveId, DocumentId, RpfNodeId}; -use super::expander::{list_archive, ListedEntry}; -use super::rpf_node::{ +use crate::state::document::{ArchiveId, DocumentId, RpfNodeId}; +use crate::state::expander::{list_archive, ListedEntry}; +use crate::state::rpf_node::{ ArchiveSlot, ArchiveSource, RpfNodeBacking, RpfSessionNode, RpfSessionNodeKind, }; @@ -18,7 +18,7 @@ const BYTE_CACHE_CAPACITY: usize = 64; type SortedChildren = ( u64, - super::explorer::SortOrder, + crate::state::explorer::SortOrder, Vec, Arc<[RpfNodeId]>, // The bytes each sorted child groups by, once a grouping by size asked. @@ -26,12 +26,12 @@ type SortedChildren = ( ); pub struct RpfEditSession { - pub(super) nodes: HashMap, - pub(super) cache: Mutex>>>, - pub(super) archives: HashMap, + pub(in crate::state) nodes: HashMap, + pub(in crate::state) cache: Mutex>>>, + pub(in crate::state) archives: HashMap, /// Each folder's children as [`super::explorer::sorted_children_at`] last sorted them, with the /// payload epoch, order and children they were sorted from. - pub(super) sorted: Mutex>, + pub(in crate::state) sorted: Mutex>, pub crypto: Arc, root_id: RpfNodeId, next_id: RpfNodeId, diff --git a/src/state/rpf_tree.rs b/src/state/rpf/rpf_tree.rs similarity index 94% rename from src/state/rpf_tree.rs rename to src/state/rpf/rpf_tree.rs index 19c3d2611..392cc01a6 100644 --- a/src/state/rpf_tree.rs +++ b/src/state/rpf/rpf_tree.rs @@ -1,4 +1,4 @@ -use super::*; +use crate::state::*; impl AppState { pub fn rpf_add_folder( @@ -20,7 +20,7 @@ impl AppState { self.rpf_add_folder_inner(doc_id, parent_id, name) } - pub(super) fn rpf_add_folder_inner( + pub(in crate::state) fn rpf_add_folder_inner( &mut self, doc_id: DocumentId, parent_id: RpfNodeId, @@ -60,7 +60,7 @@ impl AppState { let id = rpf.session.add_folder(parent_id, name)?; doc.record( tr!("Add folder {name}", name = name), - super::rpf_undo::added(id), + crate::state::rpf_undo::added(id), ); Ok(id) } @@ -145,7 +145,7 @@ impl AppState { ); doc.record( label, - super::rpf_undo::renamed(node_id, before.unwrap_or_default()), + crate::state::rpf_undo::renamed(node_id, before.unwrap_or_default()), ); Ok(()) } @@ -165,11 +165,11 @@ impl AppState { } /// Delete the row `node_id`: inside an archive as a step, on disk into the Recycle Bin at once, handing back the rows it took. - pub(super) fn rpf_delete_node_inner( + pub(in crate::state) fn rpf_delete_node_inner( &mut self, doc_id: DocumentId, node_id: RpfNodeId, - ) -> Result, String> { + ) -> Result, String> { let disk_path = self.disk_path_for_node(doc_id, node_id); if let Some(path) = &disk_path { self.no_job_holds(path, tr!("delete it"))?; @@ -186,7 +186,7 @@ impl AppState { let rows = (rpf.session.take_rows(node_id)) .ok_or_else(|| tr!("RPF node {node_id} cannot be deleted", node_id = node_id))?; let label = tr!("Delete {name}", name = name.unwrap_or_default()); - doc.record(label, super::rpf_undo::deleted(node_id, rows)); + doc.record(label, crate::state::rpf_undo::deleted(node_id, rows)); return Ok(None); }; let reached = !rpf.session.archives_opened_under(node_id).is_empty(); @@ -208,7 +208,7 @@ impl AppState { self.rpf_move_nodes(doc_id, &[node_id], new_parent) } - pub(super) fn rpf_move_node_inner( + pub(in crate::state) fn rpf_move_node_inner( &mut self, doc_id: DocumentId, node_id: RpfNodeId, @@ -260,7 +260,7 @@ impl AppState { let name = rpf.session.node(node_id).map(|n| n.name.clone()); rpf.session.move_node(node_id, new_parent)?; let label = tr!("Move {name}", name = name.unwrap_or_default()); - doc.record(label, super::rpf_undo::moved(node_id, was)); + doc.record(label, crate::state::rpf_undo::moved(node_id, was)); Ok(()) } _ => { @@ -288,7 +288,7 @@ impl AppState { self.rpf_import_file_to_folder_inner(doc_id, folder_id, file_path) } - pub(super) fn rpf_import_file_to_folder_inner( + pub(in crate::state) fn rpf_import_file_to_folder_inner( &mut self, doc_id: DocumentId, folder_id: RpfNodeId, @@ -310,7 +310,7 @@ impl AppState { } /// `bytes` added as `name` under the row `folder`: written into a folder on disk at once, or held in the archive the row shows, opened first, until a save writes it. - pub(super) fn add_file_to_row( + pub(in crate::state) fn add_file_to_row( &mut self, doc_id: DocumentId, folder: RpfNodeId, @@ -340,7 +340,10 @@ impl AppState { }, )?; // The file is on disk at once, so a step that takes it back is recorded as the file is written - doc.record(label, super::rpf_undo::wrote(written.0, written.1, id)); + doc.record( + label, + crate::state::rpf_undo::wrote(written.0, written.1, id), + ); return Ok(id); } self.open_archive_row(doc_id, folder)?; @@ -351,11 +354,14 @@ impl AppState { return Err(tr!("Document is not an RPF").to_string()); }; let id = rpf.session.add_file_copy(folder, name, bytes)?; - doc.record(tr!("Add {name}", name = name), super::rpf_undo::added(id)); + doc.record( + tr!("Add {name}", name = name), + crate::state::rpf_undo::added(id), + ); Ok(id) } - pub(super) fn disk_path_for_node( + pub(in crate::state) fn disk_path_for_node( &self, doc_id: DocumentId, node_id: RpfNodeId, @@ -372,7 +378,7 @@ impl AppState { /// /// ⚠ Not `disk_path_for_node`: an archive on disk has a path too, its own /// file's, and nothing can be created under a file. - pub(super) fn is_disk_folder(&self, doc_id: DocumentId, node_id: RpfNodeId) -> bool { + pub(in crate::state) fn is_disk_folder(&self, doc_id: DocumentId, node_id: RpfNodeId) -> bool { let Some(DocPayload::Rpf(rpf)) = self.document(doc_id).map(|d| &d.payload) else { return false; }; @@ -457,7 +463,7 @@ impl AppState { /// /// ⚠ The session's base-game Yes answers `Everything`'s question and no /// other, so it is consulted only once the mode permits the write. - pub(super) fn retail_guard_for(&self, target: Option<&Path>) -> RetailGuard { + pub(in crate::state) fn retail_guard_for(&self, target: Option<&Path>) -> RetailGuard { let path = match target { Some(p) => p, None => return RetailGuard::Allowed, @@ -489,9 +495,9 @@ impl AppState { RetailGuard::NeedsConfirmation(path.to_path_buf()) } } - retail::PathClass::PackagesOnly => { - RetailGuard::Refused(super::gta6_modding::mod_package::in_game_folder(path)) - } + retail::PathClass::PackagesOnly => RetailGuard::Refused( + crate::state::gta6_modding::mod_package::in_game_folder(path), + ), } } @@ -544,7 +550,7 @@ impl AppState { } /// Ask the gate before a tree edit; `Err` once it refused or raised `action`'s prompt, both already shown. - pub(super) fn gate_tree_edit( + pub(in crate::state) fn gate_tree_edit( &mut self, target: Option<&Path>, action: PendingRetailEdit, @@ -564,7 +570,7 @@ impl AppState { } } - pub(super) fn affected_disk_path( + pub(in crate::state) fn affected_disk_path( &self, doc_id: DocumentId, node_id: RpfNodeId, diff --git a/src/state/rpf_undo.rs b/src/state/rpf/rpf_undo.rs similarity index 94% rename from src/state/rpf_undo.rs rename to src/state/rpf/rpf_undo.rs index dfe478a1a..eb9b640a0 100644 --- a/src/state/rpf_undo.rs +++ b/src/state/rpf/rpf_undo.rs @@ -6,11 +6,11 @@ use std::path::{Path, PathBuf}; -use super::edit_history::{Change, Swap, GONE}; -use super::memory::vec_bytes; -use super::rpf_node::{ArchiveSlot, RpfNodeBacking, RpfSessionNode}; -use super::rpf_session::RpfEditSession; -use super::{ArchiveId, DocPayload, DocumentId, RpfNodeId}; +use crate::state::edit_history::{Change, Swap, GONE}; +use crate::state::memory::vec_bytes; +use crate::state::rpf_node::{ArchiveSlot, RpfNodeBacking, RpfSessionNode}; +use crate::state::rpf_session::RpfEditSession; +use crate::state::{ArchiveId, DocPayload, DocumentId, RpfNodeId}; /// Rows taken out of the tree, with every archive opened under them. pub struct Rows { @@ -35,7 +35,7 @@ impl Rows { impl RpfEditSession { /// Take the row `id` and every row under it out of the tree, as a delete does, to put back later. - pub(super) fn take_rows(&mut self, id: RpfNodeId) -> Option { + pub(in crate::state) fn take_rows(&mut self, id: RpfNodeId) -> Option { let (parent, at) = self.place_of(id)?; self.nodes.get_mut(&parent)?.children.remove(at); let (mut nodes, mut archives, mut stack) = (Vec::new(), Vec::new(), vec![id]); @@ -82,7 +82,7 @@ impl RpfEditSession { } /// The row `id`'s parent, and its place among the parent's rows. - pub(super) fn place_of(&self, id: RpfNodeId) -> Option<(RpfNodeId, usize)> { + pub(in crate::state) fn place_of(&self, id: RpfNodeId) -> Option<(RpfNodeId, usize)> { let parent = self.nodes.get(&id)?.parent?; let at = (self.nodes.get(&parent)?.children.iter()).position(|c| *c == id)?; Some((parent, at)) @@ -110,7 +110,7 @@ impl RpfEditSession { } /// Mark unsaved exactly the archives `marked` names, as they stood before a step that changed nothing. - pub(super) fn mark_unsaved_only(&mut self, marked: &[ArchiveId]) { + pub(in crate::state) fn mark_unsaved_only(&mut self, marked: &[ArchiveId]) { for (id, slot) in &mut self.archives { slot.dirty = marked.contains(id); } @@ -180,12 +180,12 @@ impl Swap for Row { } /// The step that takes out the row `id` an edit added. -pub(super) fn added(id: RpfNodeId) -> Change { +pub(in crate::state) fn added(id: RpfNodeId) -> Change { step(Row { id, held: None }) } /// The step that puts back `rows`, which a delete took out. -pub(super) fn deleted(id: RpfNodeId, rows: Rows) -> Change { +pub(in crate::state) fn deleted(id: RpfNodeId, rows: Rows) -> Change { step(Row { id, held: Some(rows), @@ -226,7 +226,7 @@ impl Swap for Renamed { } } -pub(super) fn renamed(id: RpfNodeId, other: String) -> Change { +pub(in crate::state) fn renamed(id: RpfNodeId, other: String) -> Change { step(Renamed { id, other }) } @@ -257,7 +257,7 @@ impl Swap for Moved { } } -pub(super) fn moved(id: RpfNodeId, (parent, at): (RpfNodeId, usize)) -> Change { +pub(in crate::state) fn moved(id: RpfNodeId, (parent, at): (RpfNodeId, usize)) -> Change { step(Moved { id, parent, at }) } @@ -396,7 +396,11 @@ impl Cut { } /// Each file and folder at `path` on disk, folders first, with the row under `folder` its paste made the copy; `None` where one has no copy there. -pub(super) fn copies(session: &RpfEditSession, folder: RpfNodeId, path: &Path) -> Option { +pub(in crate::state) fn copies( + session: &RpfEditSession, + folder: RpfNodeId, + path: &Path, +) -> Option { let name = path.file_name()?.to_str()?.trim(); let copy = (session.children_of(folder).into_iter()).find(|&row| { session @@ -414,7 +418,7 @@ pub(super) fn copies(session: &RpfEditSession, folder: RpfNodeId, path: &Path) - } /// The part of a paste's step that brings back a row cut from disk where `files` were, `taken` from the tree when it is the paste's own; `None` where the row held an opened archive, whose delete empties the history. -pub(super) fn cut( +pub(in crate::state) fn cut( files: Copies, taken: Option<(RpfNodeId, Rows)>, from: Option, @@ -523,7 +527,7 @@ impl Written { } /// The step that takes back the file `bytes` written at `path`, shown by the row `id`. -pub(super) fn wrote(path: PathBuf, bytes: Vec, id: RpfNodeId) -> Change { +pub(in crate::state) fn wrote(path: PathBuf, bytes: Vec, id: RpfNodeId) -> Change { step(Written { path, bytes, diff --git a/src/state/sinks/mod.rs b/src/state/sinks.rs similarity index 100% rename from src/state/sinks/mod.rs rename to src/state/sinks.rs diff --git a/src/state/a_b_compares_the_pack_with_its_previous_kept_version.rs b/src/state/tests/a_b_compares_the_pack_with_its_previous_kept_version.rs similarity index 100% rename from src/state/a_b_compares_the_pack_with_its_previous_kept_version.rs rename to src/state/tests/a_b_compares_the_pack_with_its_previous_kept_version.rs diff --git a/src/state/a_bones_numbers_can_be_edited.rs b/src/state/tests/a_bones_numbers_can_be_edited.rs similarity index 99% rename from src/state/a_bones_numbers_can_be_edited.rs rename to src/state/tests/a_bones_numbers_can_be_edited.rs index 06ab7e408..1465a68d4 100644 --- a/src/state/a_bones_numbers_can_be_edited.rs +++ b/src/state/tests/a_bones_numbers_can_be_edited.rs @@ -14,12 +14,16 @@ use or_io::Asset; use or_test_support::{skip_corpus, Corpus, TARGET_GEN8, TARGET_GEN9}; use super::an_edit_stays_where_it_was_made::{open, texts, Inspector}; -use super::bone_numbers::{bone_selected, euler_degrees, skeleton_of, BoneAddress, BoneEdit}; use super::nested_archives_survive_a_save::save; -use super::textures::FRAGMENT_ENTRY_HASH; use super::the_animation_preview_draws_what_its_sources_hold::{a_clip_over_the_rig, rigged, CLIP}; -use super::{AppState, DictPart, DocPayload, DocumentId, Game, SelectionKey, SkeletonSource}; +use crate::state::bone_numbers::{ + bone_selected, euler_degrees, skeleton_of, BoneAddress, BoneEdit, +}; +use crate::state::textures::FRAGMENT_ENTRY_HASH; use crate::state::Workspace; +use crate::state::{ + AppState, DictPart, DocPayload, DocumentId, Game, SelectionKey, SkeletonSource, +}; const TARGETS: [(&str, Game); 2] = [ (TARGET_GEN8, Game::GtaVLegacy), diff --git a/src/state/a_change_on_disk_keeps_the_undo_steps_beside_it.rs b/src/state/tests/a_change_on_disk_keeps_the_undo_steps_beside_it.rs similarity index 97% rename from src/state/a_change_on_disk_keeps_the_undo_steps_beside_it.rs rename to src/state/tests/a_change_on_disk_keeps_the_undo_steps_beside_it.rs index a8594d0c4..2b650e961 100644 --- a/src/state/a_change_on_disk_keeps_the_undo_steps_beside_it.rs +++ b/src/state/tests/a_change_on_disk_keeps_the_undo_steps_beside_it.rs @@ -9,11 +9,11 @@ use super::every_add_lands_where_the_tree_shows_it::opened; use super::nested_archives_survive_a_save::{archive, body, errors, on_disk, save}; use super::opening_a_ydd::node_at; use super::undo_from_files_acts_on_what_files_shows::name_of; -use super::{AppState, DocPayload, DocumentId, EditHistory}; use crate::platform::recycle_bin; +use crate::state::{AppState, DocPayload, DocumentId, EditHistory}; /// `files` written under `root/mods` and opened with Open Folder, with `root/bin` this thread's Recycle Bin. -pub(super) fn a_folder(root: &Path, files: &[(&str, &[u8])]) -> (AppState, DocumentId) { +pub(in crate::state) fn a_folder(root: &Path, files: &[(&str, &[u8])]) -> (AppState, DocumentId) { let mods = root.join("mods"); for (path, bytes) in files { let path = mods.join(path); @@ -28,7 +28,7 @@ pub(super) fn a_folder(root: &Path, files: &[(&str, &[u8])]) -> (AppState, Docum (state, doc) } -pub(super) fn marked(state: &AppState, doc: DocumentId) -> bool { +pub(in crate::state) fn marked(state: &AppState, doc: DocumentId) -> bool { state.document(doc).is_some_and(|d| d.dirty) } diff --git a/src/state/a_drag_carries_every_selected_row.rs b/src/state/tests/a_drag_carries_every_selected_row.rs similarity index 99% rename from src/state/a_drag_carries_every_selected_row.rs rename to src/state/tests/a_drag_carries_every_selected_row.rs index 9ba19d963..a4a51a2fc 100644 --- a/src/state/a_drag_carries_every_selected_row.rs +++ b/src/state/tests/a_drag_carries_every_selected_row.rs @@ -8,8 +8,8 @@ use super::copy_cut_and_paste::names_under; use super::nested_archives_survive_a_save::errors; use super::the_files_view_in_the_centre::{accessible, browsing, find, leaf_of, node}; use super::undo_from_files_acts_on_what_files_shows::ctrl_z; -use super::AppState; use crate::state::panel_ids as ids; +use crate::state::AppState; use crate::ui::panels::hierarchy::{ui_state, RENAME_TRIGGER_DELAY}; /// A frame at `time` with `events`. diff --git a/src/state/a_drag_copies_and_a_change_of_nothing_does_nothing.rs b/src/state/tests/a_drag_copies_and_a_change_of_nothing_does_nothing.rs similarity index 98% rename from src/state/a_drag_copies_and_a_change_of_nothing_does_nothing.rs rename to src/state/tests/a_drag_copies_and_a_change_of_nothing_does_nothing.rs index 4009fb097..850b22a29 100644 --- a/src/state/a_drag_copies_and_a_change_of_nothing_does_nothing.rs +++ b/src/state/tests/a_drag_copies_and_a_change_of_nothing_does_nothing.rs @@ -7,18 +7,18 @@ use egui::PointerButton::{Primary, Secondary}; use super::a_right_click_or_a_drag_selects_its_row::frame_with; use super::copy_cut_and_paste::{forget_offered, names_under}; -use super::navigation::Location; use super::nested_archives_survive_a_save::{archive, errors}; use super::opening_a_ydd::node_at; -use super::prefs::EditMode; use super::the_files_view_in_the_centre::{ accessible, browsing, click, click_with, find, frame, in_the_listing, leaf_of, node, settled, }; use super::two_readers_of_one_archive_across_a_save::install; use super::undo_from_files_acts_on_what_files_shows::ctrl_z; -use super::{AppState, DocPayload, DocumentId, RetailEditDecision}; use crate::platform::clipboard::fake; +use crate::state::navigation::Location; use crate::state::panel_ids as ids; +use crate::state::prefs::EditMode; +use crate::state::{AppState, DocPayload, DocumentId, RetailEditDecision}; fn button(at: egui::Pos2, pressed: bool, modifiers: Modifiers) -> egui::Event { egui::Event::PointerButton { @@ -418,7 +418,7 @@ fn a_copys_staged_files_are_gone_once_its_gate_question_is_answered() { state.retail_edit_session_allow = false; assert_eq!(state.rpf_copy_nodes(tree, &rows, b_row), Ok(())); let staged = match state.pending_retail_edit.as_ref().map(|p| &p.action) { - Some(super::PendingRetailEdit::ImportPaths { + Some(crate::state::PendingRetailEdit::ImportPaths { staged: Some(staged), .. }) => staged.folder().to_path_buf(), diff --git a/src/state/a_field_that_shapes_the_data_is_not_edited_in_place.rs b/src/state/tests/a_field_that_shapes_the_data_is_not_edited_in_place.rs similarity index 97% rename from src/state/a_field_that_shapes_the_data_is_not_edited_in_place.rs rename to src/state/tests/a_field_that_shapes_the_data_is_not_edited_in_place.rs index 23c889de4..79e7b55f9 100644 --- a/src/state/a_field_that_shapes_the_data_is_not_edited_in_place.rs +++ b/src/state/tests/a_field_that_shapes_the_data_is_not_edited_in_place.rs @@ -12,11 +12,11 @@ use or_io::desc::{FieldRepr, Pack, PackType}; use or_io::gta5::formats::Format; use or_io::gta5::{gen8::GrcTexture, File as _, PgDictionary}; -use super::document::{DocPayload, Document}; use super::opening_a_ydd::finish_load; -use super::prefs::Game; -use super::textures::TextureSource; -use super::{AppState, CloseAnswer}; +use crate::state::document::{DocPayload, Document}; +use crate::state::prefs::Game; +use crate::state::textures::TextureSource; +use crate::state::{AppState, CloseAnswer}; const WHAT: &str = "every_field_that_shapes_data_draws_read_only_with_a_reason_in_every_corpus_kind"; @@ -74,7 +74,7 @@ struct Walked { /// What `doc`'s grid draws of each field the list holds, at every node of its outline; `None` where nothing is described. fn walked(doc: &Document, path: &Path) -> Option { - let (pack, _) = super::described_root(doc)?; + let (pack, _) = crate::state::described_root(doc)?; let image = doc.resource.as_ref()?; let outline = crate::ui::panels::hierarchy::described_outline(doc)?; let format = or_io::gta5::formats::format(doc.kind().extension())?; @@ -271,12 +271,12 @@ fn holding_paint() -> AppState { /// `paint` as a save of document 1 writes it, read back. fn saved_paint(state: &AppState) -> GrcTexture { - let bytes = super::document_io::serialize_payload( + let bytes = crate::state::document_io::serialize_payload( &state .document(crate::state::DocumentId(1)) .expect("open") .payload, - super::prefs::RpfOutputMode::Open, + crate::state::prefs::RpfOutputMode::Open, std::sync::Arc::new(or_io::container::NoOpCryptoProvider::new()), ) .expect("a Legacy .ytd saves"); diff --git a/src/state/a_garments_cloth_is_linked_and_its_shop_ids_are_kept.rs b/src/state/tests/a_garments_cloth_is_linked_and_its_shop_ids_are_kept.rs similarity index 97% rename from src/state/a_garments_cloth_is_linked_and_its_shop_ids_are_kept.rs rename to src/state/tests/a_garments_cloth_is_linked_and_its_shop_ids_are_kept.rs index 5326aaabd..756feac3d 100644 --- a/src/state/a_garments_cloth_is_linked_and_its_shop_ids_are_kept.rs +++ b/src/state/tests/a_garments_cloth_is_linked_and_its_shop_ids_are_kept.rs @@ -10,9 +10,9 @@ use std::time::{Duration, Instant}; use or_wardrobe::Garment; -use super::front_door::{NewProject, Template}; -use super::workbench::{Choice, Question}; -use super::{AppState, Prefs}; +use crate::state::front_door::{NewProject, Template}; +use crate::state::workbench::{Choice, Question}; +use crate::state::{AppState, Prefs}; use crate::ui::commands::{self, Action}; const C: &str = "mp_m_freemode_01_mp_m_t"; diff --git a/src/state/a_gta_vi_archive_s_scan_is_kept.rs b/src/state/tests/a_gta_vi_archive_s_scan_is_kept.rs similarity index 100% rename from src/state/a_gta_vi_archive_s_scan_is_kept.rs rename to src/state/tests/a_gta_vi_archive_s_scan_is_kept.rs diff --git a/src/state/a_model_is_drawn_with_its_own_textures.rs b/src/state/tests/a_model_is_drawn_with_its_own_textures.rs similarity index 95% rename from src/state/a_model_is_drawn_with_its_own_textures.rs rename to src/state/tests/a_model_is_drawn_with_its_own_textures.rs index 6591697ec..2eb1cbdf8 100644 --- a/src/state/a_model_is_drawn_with_its_own_textures.rs +++ b/src/state/tests/a_model_is_drawn_with_its_own_textures.rs @@ -10,10 +10,10 @@ use or_io::gta5::gen8::GrcTexture; use or_io::gta5::PgDictionary; use or_io::Asset; -use super::document::DocumentId; use super::opening_a_ydd::{finish_load, node_at}; -use super::texture_resolution::{resolve, ResolutionRule}; -use super::{AppState, DocumentKind, Prefs}; +use crate::state::document::DocumentId; +use crate::state::texture_resolution::{resolve, ResolutionRule}; +use crate::state::{AppState, DocumentKind, Prefs}; /// A `.ytd` holding one 8×8 texture called `texture`. fn ytd(texture: &str) -> Vec { @@ -87,7 +87,7 @@ fn yft() -> Vec { #[test] fn a_vehicle_opens_the_dictionaries_every_vehicle_shares_only_while_a_name_is_still_missing() { - use super::texture_resolution::report; + use crate::state::texture_resolution::report; let mut f = Folder::of(&[ ("car.yft", yft()), ("car.ytd", ytd("own")), diff --git a/src/state/a_moved_or_deleted_archive_row_leaves_nothing_behind.rs b/src/state/tests/a_moved_or_deleted_archive_row_leaves_nothing_behind.rs similarity index 93% rename from src/state/a_moved_or_deleted_archive_row_leaves_nothing_behind.rs rename to src/state/tests/a_moved_or_deleted_archive_row_leaves_nothing_behind.rs index 36804b70a..4fb3e12c1 100644 --- a/src/state/a_moved_or_deleted_archive_row_leaves_nothing_behind.rs +++ b/src/state/tests/a_moved_or_deleted_archive_row_leaves_nothing_behind.rs @@ -8,15 +8,18 @@ use std::path::Path; use or_io::container::rpf::BodyForm; -use super::document::DocumentId; use super::every_add_lands_where_the_tree_shows_it::opened; use super::nested_archives_survive_a_save::{archive, body, errors, nested, on_disk, save}; use super::opening_a_ydd::node_at; use super::two_readers_of_one_archive_across_a_save::{install, save_alone}; -use super::AppState; +use crate::state::document::DocumentId; +use crate::state::AppState; /// `files` written into a new folder `mods`, opened with Open Folder. -pub(super) fn folder_of(root: &Path, files: &[(&str, Vec)]) -> (AppState, DocumentId) { +pub(in crate::state) fn folder_of( + root: &Path, + files: &[(&str, Vec)], +) -> (AppState, DocumentId) { let folder = root.join("mods"); std::fs::create_dir_all(&folder).expect("the folder"); for (name, bytes) in files { diff --git a/src/state/a_new_project.rs b/src/state/tests/a_new_project.rs similarity index 97% rename from src/state/a_new_project.rs rename to src/state/tests/a_new_project.rs index 6ad31a87d..a5a638ad8 100644 --- a/src/state/a_new_project.rs +++ b/src/state/tests/a_new_project.rs @@ -5,8 +5,8 @@ use std::path::{Path, PathBuf}; use or_project::ModuleKind; -use super::front_door::{NewProject, Template}; -use super::project::load_project; +use crate::state::front_door::{NewProject, Template}; +use crate::state::project::load_project; /// Every file and folder under `root`, relative and with `/`, folders ending in `/`. fn walk(root: &Path) -> BTreeSet { diff --git a/src/state/a_pick_in_the_preview_opens_its_document_at_its_row.rs b/src/state/tests/a_pick_in_the_preview_opens_its_document_at_its_row.rs similarity index 99% rename from src/state/a_pick_in_the_preview_opens_its_document_at_its_row.rs rename to src/state/tests/a_pick_in_the_preview_opens_its_document_at_its_row.rs index cc680625f..f38cdb711 100644 --- a/src/state/a_pick_in_the_preview_opens_its_document_at_its_row.rs +++ b/src/state/tests/a_pick_in_the_preview_opens_its_document_at_its_row.rs @@ -10,8 +10,8 @@ use super::the_viewport_picks_what_it_draws::{ click_on_the_bone, previewing, previewing_a_triangle, ray, Holder, }; use super::viewport_basics_for_inspecting_assets::the_outline_shows; -use super::{AppState, DocumentId, SelectionKey, Workspace}; use crate::render::viewport::pick::{select_model_under, select_under}; +use crate::state::{AppState, DocumentId, SelectionKey, Workspace}; use crate::ui::panels::viewport::draw_viewport_overlay; use crate::ui::panels::viewport::layout::column; diff --git a/src/state/a_pinned_inspector_shows_its_own_document.rs b/src/state/tests/a_pinned_inspector_shows_its_own_document.rs similarity index 98% rename from src/state/a_pinned_inspector_shows_its_own_document.rs rename to src/state/tests/a_pinned_inspector_shows_its_own_document.rs index a696e70d5..b4c75b47c 100644 --- a/src/state/a_pinned_inspector_shows_its_own_document.rs +++ b/src/state/tests/a_pinned_inspector_shows_its_own_document.rs @@ -11,7 +11,7 @@ use or_io::Asset; use or_test_support::{skip_corpus, Corpus, TARGET_GEN8}; use super::an_edit_stays_where_it_was_made::{open, texts, Inspector}; -use super::{AppState, DictPart, DocPayload, Document, DocumentId, SelectionKey}; +use crate::state::{AppState, DictPart, DocPayload, Document, DocumentId, SelectionKey}; use crate::ui::panels::inspector::{self, InspectorUiState}; /// How many staged files of a kind are opened, smallest first, to find a pair to test. @@ -50,7 +50,7 @@ impl Gesture { }; match (self, &doc.payload) { (Gesture::Grid, _) => { - let (_, root) = super::described_root(doc)?; + let (_, root) = crate::state::described_root(doc)?; let summary = inspector::summary_at(doc, &root, 0)?; let row = summary.rows.iter().find(|r| { let number = r.edit.is_some_and(|e| e.kind == EditKind::F32); diff --git a/src/state/a_plugin_asks_before_it_runs.rs b/src/state/tests/a_plugin_asks_before_it_runs.rs similarity index 92% rename from src/state/a_plugin_asks_before_it_runs.rs rename to src/state/tests/a_plugin_asks_before_it_runs.rs index 894514c41..64069d831 100644 --- a/src/state/a_plugin_asks_before_it_runs.rs +++ b/src/state/tests/a_plugin_asks_before_it_runs.rs @@ -13,18 +13,18 @@ use std::sync::OnceLock; use or_plugin::{Capability, Manifest, ABI_VERSION}; -use super::plugins::{Consent, InstalledPlugin}; -use super::{AppState, Document, DocumentKind, EditMode}; +use crate::state::plugins::{Consent, InstalledPlugin}; +use crate::state::{AppState, Document, DocumentKind, EditMode}; const WASM32: &str = "wasm32-unknown-unknown"; /// The sample guest built with `features`, into its own directory under the test binary's target directory. -pub(super) fn built_sample(features: &str, directory: &str) -> PathBuf { +pub(in crate::state) fn built_sample(features: &str, directory: &str) -> PathBuf { built_plugin("or-plugin-sample", features, directory) } /// The plugin `package` of `plugins/` built with `features`, into its own directory under the test binary's target directory. -pub(super) fn built_plugin(package: &str, features: &str, directory: &str) -> PathBuf { +pub(in crate::state) fn built_plugin(package: &str, features: &str, directory: &str) -> PathBuf { let plugins = Path::new(env!("CARGO_MANIFEST_DIR")).join("plugins"); // ⚠ Under the test binary's own target directory (`target/debug/deps/`), never `$TEMP`: // it is kept between runs, so a folder there would outlive the lane that built it. @@ -92,14 +92,14 @@ fn state_with(plugin: &InstalledPlugin, path: PathBuf) -> AppState { state.plugins.scanned = Some(vec![plugin.clone()]); let resource = KIND.resource_type().expect("a paged format"); - let handler = super::payload_handlers::handler_for(resource, or_io::Generation::Gen8) + let handler = crate::state::payload_handlers::handler_for(resource, or_io::Generation::Gen8) .expect("a payload handler"); let payload = (handler.empty)(); let bytes = handler.save(&payload).expect("a blank serializes"); let mut doc = Document::new(crate::state::DocumentId(1), Some(path), payload); - doc.set_resource(super::document_io::resource_image_for(KIND, &bytes)); + doc.set_resource(crate::state::document_io::resource_image_for(KIND, &bytes)); assert!( - super::described_root(&doc).is_some(), + crate::state::described_root(&doc).is_some(), "the sample reads a described root" ); state.documents.push(doc); @@ -165,8 +165,8 @@ fn authored_ydd(first: f32) -> Vec { .expect("a dictionary of one drawable saves") } -pub(super) fn first_distance(doc: &Document) -> f32 { - let super::document::DocPayload::Resource(or_io::Asset::DrawableDict(dictionary)) = +pub(in crate::state) fn first_distance(doc: &Document) -> f32 { + let crate::state::document::DocPayload::Resource(or_io::Asset::DrawableDict(dictionary)) = &doc.payload else { panic!( @@ -197,19 +197,19 @@ fn bytes_plugin(id: &str) -> InstalledPlugin { } /// A state with `plugin` installed and `authored_ydd(100.0)` open at `path`, on the editor's own fuel. -pub(super) fn state_with_ydd(plugin: &InstalledPlugin, path: PathBuf) -> AppState { +pub(in crate::state) fn state_with_ydd(plugin: &InstalledPlugin, path: PathBuf) -> AppState { let mut state = AppState::default(); state.plugins.scanned = Some(vec![plugin.clone()]); let bytes = authored_ydd(100.0); let resource = DocumentKind::Ydd.resource_type().expect("a paged format"); - let handler = super::payload_handlers::handler_for(resource, or_io::Generation::Gen8) + let handler = crate::state::payload_handlers::handler_for(resource, or_io::Generation::Gen8) .expect("a payload handler"); let payload = handler .open(&path, &bytes) .expect("the authored .ydd reads"); let mut doc = Document::new(crate::state::DocumentId(1), Some(path), payload); - doc.set_resource(super::document_io::resource_image_for( + doc.set_resource(crate::state::document_io::resource_image_for( DocumentKind::Ydd, &bytes, )); @@ -323,7 +323,7 @@ fn a_written_file_must_read_back_and_save_at_the_documents_target() { let plugin = bytes_plugin("bytes-check"); let dir = tempfile::tempdir().expect("a scratch directory"); let state = state_with_ydd(&plugin, dir.path().join("thing.ydd")); - let check = super::plugins::save_check(state.active_document().expect("open")) + let check = crate::state::plugins::save_check(state.active_document().expect("open")) .expect("a .ydd has a save check"); assert_eq!( @@ -371,7 +371,7 @@ fn an_unreadable_answer_costs_only_itself() { ) .expect("write"); - let prefs = super::prefs::load_prefs_from(&path); + let prefs = crate::state::prefs::load_prefs_from(&path); assert!(!prefs.read_overlay_first, "the rest of the file was read"); assert_eq!( prefs.plugin_consent.into_iter().collect::>(), diff --git a/src/state/a_project_holds_only_sources.rs b/src/state/tests/a_project_holds_only_sources.rs similarity index 98% rename from src/state/a_project_holds_only_sources.rs rename to src/state/tests/a_project_holds_only_sources.rs index ac239e7cc..5445f4ccb 100644 --- a/src/state/a_project_holds_only_sources.rs +++ b/src/state/tests/a_project_holds_only_sources.rs @@ -13,11 +13,11 @@ use or_source::sample::{drawable_dictionary, texture_dictionary}; use or_wardrobe::follow::{follow, Led}; use or_wardrobe::Garment; -use super::front_door::{NewProject, Template}; use super::importing_game_files_from_the_app::{imported, project, row, sources_of, until}; -use super::os_drop::DropTarget; -use super::workbench::{Choice, LastBuild, Missing, Question, Wanting}; -use super::{AppState, Prefs}; +use crate::state::front_door::{NewProject, Template}; +use crate::state::os_drop::DropTarget; +use crate::state::workbench::{Choice, LastBuild, Missing, Question, Wanting}; +use crate::state::{AppState, Prefs}; const C: &str = "mp_m_freemode_01_mp_m_t"; @@ -263,7 +263,7 @@ fn an_asset_json_a_textures_src_and_a_folder_with_nested_sources_import_in_one_s imported(&mut state); let report = &state.workbench.imports.report().expect("a report").report; - let [made, already, kept, refused] = super::workbench::counts(report); + let [made, already, kept, refused] = crate::state::workbench::counts(report); assert_eq!( (made, kept, refused), (4, 1, 0), diff --git a/src/state/a_recook_reloads_what_is_open.rs b/src/state/tests/a_recook_reloads_what_is_open.rs similarity index 96% rename from src/state/a_recook_reloads_what_is_open.rs rename to src/state/tests/a_recook_reloads_what_is_open.rs index 1801d8043..b4f94cff6 100644 --- a/src/state/a_recook_reloads_what_is_open.rs +++ b/src/state/tests/a_recook_reloads_what_is_open.rs @@ -13,12 +13,12 @@ use or_io::codec::texture::{decode_level, GrcTextureFormat, RgbaImage}; use or_io::gta5::{GtaDrawable, PgDictionary}; use or_io::Asset; -use super::document::{Document, DocumentId}; use super::opening_a_ydd::finish_load; -use super::textures::{self, TextureListing}; use super::the_project_workspace::{opened, png, row, until}; -use super::workbench::AssetState; -use super::{AppState, Prefs, TextureSource}; +use crate::state::document::{Document, DocumentId}; +use crate::state::textures::{self, TextureListing}; +use crate::state::workbench::AssetState; +use crate::state::{AppState, Prefs, TextureSource}; /// A project with a textures source cooked once, and its cooked file open as a tab. struct Cooked { diff --git a/src/state/a_rename_on_disk_waits_for_the_extraction_reading_it.rs b/src/state/tests/a_rename_on_disk_waits_for_the_extraction_reading_it.rs similarity index 93% rename from src/state/a_rename_on_disk_waits_for_the_extraction_reading_it.rs rename to src/state/tests/a_rename_on_disk_waits_for_the_extraction_reading_it.rs index 5e96ecea0..3f793dd1a 100644 --- a/src/state/a_rename_on_disk_waits_for_the_extraction_reading_it.rs +++ b/src/state/tests/a_rename_on_disk_waits_for_the_extraction_reading_it.rs @@ -5,12 +5,12 @@ use or_io::container::rpf::BodyForm; use super::every_add_lands_where_the_tree_shows_it::opened; -use super::extract_job::TypeFilter; -use super::extract_planning::Counting; use super::nested_archives_survive_a_save::archive; use super::nothing_extracts_into_an_install::{files_under, run_to_completion}; use super::opening_a_ydd::node_at; -use super::{AppState, DocumentId, RpfNodeId}; +use crate::state::extract_job::TypeFilter; +use crate::state::extract_planning::Counting; +use crate::state::{AppState, DocumentId, RpfNodeId}; /// ⚠ The extraction counts as reading until the per-frame tick takes its /// report, so nothing here ticks it before the changes it refuses. @@ -50,7 +50,7 @@ fn an_archive_renamed_or_moved_while_an_extraction_reads_it_is_refused() { } /// `sub` holds two archives the tree lists and has not opened, and the loose `more`. -pub(super) fn sub_of_unopened_archives( +pub(in crate::state) fn sub_of_unopened_archives( dir: &std::path::Path, more: &[(&str, Vec)], ) -> (AppState, DocumentId, RpfNodeId) { @@ -70,7 +70,7 @@ pub(super) fn sub_of_unopened_archives( } /// The counts under `row` once the click on Count types has opened the rows under it, asked as the menu asks, every frame. -pub(super) fn counted( +pub(in crate::state) fn counted( state: &mut AppState, doc: DocumentId, row: RpfNodeId, diff --git a/src/state/a_right_click_or_a_drag_selects_its_row.rs b/src/state/tests/a_right_click_or_a_drag_selects_its_row.rs similarity index 97% rename from src/state/a_right_click_or_a_drag_selects_its_row.rs rename to src/state/tests/a_right_click_or_a_drag_selects_its_row.rs index 54c59a1ee..d7683d16f 100644 --- a/src/state/a_right_click_or_a_drag_selects_its_row.rs +++ b/src/state/tests/a_right_click_or_a_drag_selects_its_row.rs @@ -3,18 +3,18 @@ use egui::PointerButton::{Primary, Secondary}; -use super::navigation::Location; use super::the_files_view_in_the_centre::{ accessible, browsing, click_with, find, frame, labels, leaf_of, node, settled, }; use super::undo_from_files_acts_on_what_files_shows::{ an_archive, ctrl_z, name_of, rename_with_f2, }; -use super::{AppState, Prefs, SelectionKey}; +use crate::state::navigation::Location; use crate::state::panel_ids as ids; +use crate::state::{AppState, Prefs, SelectionKey}; /// One frame of the dock and then of what crosses the window's edge, as the app draws them. -pub(super) fn frame_with( +pub(in crate::state) fn frame_with( ctx: &egui::Context, state: &mut AppState, input: egui::RawInput, diff --git a/src/state/a_save_names_its_destination.rs b/src/state/tests/a_save_names_its_destination.rs similarity index 88% rename from src/state/a_save_names_its_destination.rs rename to src/state/tests/a_save_names_its_destination.rs index c4ab3409c..f5764929e 100644 --- a/src/state/a_save_names_its_destination.rs +++ b/src/state/tests/a_save_names_its_destination.rs @@ -5,11 +5,11 @@ use std::path::{Path, PathBuf}; -use super::document::{Document, DocumentId, RpfNodeId, TextDocument}; -use super::prefs::{EditMode, ExportFixes}; -use super::rpf_session::{RpfEditSession, RpfEntryBinding}; -use super::save_destination::SaveDestination; -use super::{AppState, DocPayload, RpfNodeBacking, RpfOutputMode}; +use crate::state::document::{Document, DocumentId, RpfNodeId, TextDocument}; +use crate::state::prefs::{EditMode, ExportFixes}; +use crate::state::rpf_session::{RpfEditSession, RpfEntryBinding}; +use crate::state::save_destination::SaveDestination; +use crate::state::{AppState, DocPayload, RpfNodeBacking, RpfOutputMode}; const SHIPPED: &[u8] = b"shipped"; const EDITED: &[u8] = b"edited"; @@ -33,16 +33,18 @@ fn mounted(root: &Path, install: bool, mode: EditMode, name: &str, shipped: &[u8 state.retail_edit_session_allow = false; state.prefs.edit_mode = mode; state.prefs.export_fixes = ExportFixes::Ask; - let bytes = super::document_io::serialize_archive_records( + let bytes = crate::state::document_io::serialize_archive_records( vec![(name.to_string(), shipped.to_vec(), false)], RpfOutputMode::Open, state.keys.provider(), ) .expect("archive bytes"); std::fs::write(&archive_path, bytes).expect("archive"); - let archive = - super::rpf_archive_open::open_archive_from_disk(&archive_path, state.keys.provider()) - .expect("open the archive"); + let archive = crate::state::rpf_archive_open::open_archive_from_disk( + &archive_path, + state.keys.provider(), + ) + .expect("open the archive"); state.open_game_root(root.to_path_buf()); let game = state.documents[0].id; @@ -64,7 +66,7 @@ fn mounted(root: &Path, install: bool, mode: EditMode, name: &str, shipped: &[u8 { *archive_id = Some(id); } - let listing = super::expander::list_archive(archive).expect("list"); + let listing = crate::state::expander::list_archive(archive).expect("list"); rpf.session .populate_archive_children(node, id, &listing) .expect("populate"); @@ -99,8 +101,9 @@ fn open_entry(state: &mut AppState, game: DocumentId, entry: RpfNodeId, name: &s /// The bytes `name` holds in the archive at `path`, read back from disk. fn entry_on_disk(state: &AppState, path: &Path, name: &str) -> Vec { - let archive = super::rpf_archive_open::open_archive_from_disk(path, state.keys.provider()) - .expect("the archive reopens"); + let archive = + crate::state::rpf_archive_open::open_archive_from_disk(path, state.keys.provider()) + .expect("the archive reopens"); let session = RpfEditSession::from_archive((*archive).clone()).expect("the archive lists"); let id = session .children_of(session.root_id()) @@ -182,6 +185,6 @@ fn every_destination_is_behind_the_gate() { assert!(f.state.pending_retail_edit.is_some(), "the gate asks first"); assert_eq!(std::fs::read(&f.archive).expect("archive"), before); f.state - .apply_pending_retail_edit(super::RetailEditDecision::YesSession); + .apply_pending_retail_edit(crate::state::RetailEditDecision::YesSession); assert_eq!(entry_on_disk(&f.state, &f.archive, "a.txt"), EDITED); } diff --git a/src/state/a_self_check_keeps_to_itself.rs b/src/state/tests/a_self_check_keeps_to_itself.rs similarity index 99% rename from src/state/a_self_check_keeps_to_itself.rs rename to src/state/tests/a_self_check_keeps_to_itself.rs index f32146e83..97e356a21 100644 --- a/src/state/a_self_check_keeps_to_itself.rs +++ b/src/state/tests/a_self_check_keeps_to_itself.rs @@ -15,13 +15,13 @@ use super::every_add_lands_where_the_tree_shows_it::opened; use super::opening_a_ydd::{finish_load, node_at}; use super::opening_an_awc::three_streams; use super::the_files_view_in_the_centre::{accessible, click_with, find, frame, leaf_of, settled}; -use super::{ - config_root, real_config_root, AppState, DocPayload, DocumentKind, ExtractionResult, Game, - Prefs, -}; use crate::audio::{AudioSink, NullSink}; use crate::platform::{clipboard, recycle_bin}; use crate::state::panel_ids as ids; +use crate::state::{ + config_root, real_config_root, AppState, DocPayload, DocumentKind, ExtractionResult, Game, + Prefs, +}; use crate::ui::commands::{self, Action, Target}; /// The state a self-check starts from: its scratch configuration holds no preferences. diff --git a/src/state/a_skeleton_is_seen_without_an_animation.rs b/src/state/tests/a_skeleton_is_seen_without_an_animation.rs similarity index 99% rename from src/state/a_skeleton_is_seen_without_an_animation.rs rename to src/state/tests/a_skeleton_is_seen_without_an_animation.rs index 4186b78a3..ed6d95a20 100644 --- a/src/state/a_skeleton_is_seen_without_an_animation.rs +++ b/src/state/tests/a_skeleton_is_seen_without_an_animation.rs @@ -12,19 +12,19 @@ use or_renderer::LineVertex; use or_test_support::{skip_corpus, Corpus, TARGET_GEN8, TARGET_GEN9}; use super::an_edit_stays_where_it_was_made::{texts, Inspector}; -use super::bone_numbers::{skeleton_of, BoneAddress, BoneEdit}; -use super::prefs::{load_prefs_from, Prefs}; use super::the_animation_preview_draws_what_its_sources_hold::{a_clip_over_the_rig, rigged, CLIP}; use super::the_panels_around_the_viewer_take_both_targets::{a_list, Fixture, MODEL}; use super::the_viewport_picks_what_it_draws::{picked, ray, Held, Holder, MIDDLE_OF_THE_BONE}; use super::viewport_basics_for_inspecting_assets::{ click_in_the_row, opened, the_outline_shows, the_row_shows, }; -use super::{AppState, DictPart, DocPayload, DocumentId, SelectionKey}; use crate::render::skeleton_lines::{BONE, SELECTED}; use crate::render::viewport::bones; use crate::render::viewport::pick::select_under; +use crate::state::bone_numbers::{skeleton_of, BoneAddress, BoneEdit}; +use crate::state::prefs::{load_prefs_from, Prefs}; use crate::state::Workspace; +use crate::state::{AppState, DictPart, DocPayload, DocumentId, SelectionKey}; use crate::ui::panels::viewport::layout::overlay_text; /// How far, in metres, a line's end may be from the rest pose a file states. @@ -677,7 +677,7 @@ fn editing_the_bone_of_a_particle_model() { let row = SelectionKey::dict_part(MODEL, DictPart::Bone(1)); let payload = &state.document(doc).expect("open").payload; assert_eq!( - super::bone_numbers::bone_selected(payload, row), + crate::state::bone_numbers::bone_selected(payload, row), Some(at), "the bone row of a particle model names no bone" ); diff --git a/src/state/a_wardrobe_edit_is_recoverable.rs b/src/state/tests/a_wardrobe_edit_is_recoverable.rs similarity index 99% rename from src/state/a_wardrobe_edit_is_recoverable.rs rename to src/state/tests/a_wardrobe_edit_is_recoverable.rs index ff6720e2f..30c13a14d 100644 --- a/src/state/a_wardrobe_edit_is_recoverable.rs +++ b/src/state/tests/a_wardrobe_edit_is_recoverable.rs @@ -13,8 +13,8 @@ use or_wardrobe::edit::Edit; use or_wardrobe::Wardrobe; use super::the_wardrobe_workspace::{bare, drop_files, garments, opened, until, C}; -use super::workbench::{Finding, Fix, Question}; -use super::AppState; +use crate::state::workbench::{Finding, Fix, Question}; +use crate::state::AppState; use crate::state::Workspace; use crate::ui::commands::{self, Action}; @@ -284,7 +284,7 @@ fn edit_undo_and_redo_in_the_wardrobe_join_the_clothes_changes_and_the_project_s // Redo makes again in the order Undo took back: the drop, then the project's step. assert_eq!( state.joined_redo_side(), - Some(super::workbench::Side::Wardrobe) + Some(crate::state::workbench::Side::Wardrobe) ); commands::run_action(&mut state, &ctx, Action::Redo); until(&mut state, "the drop made again", |s| garments(s) == 2); diff --git a/src/state/adding_a_format.rs b/src/state/tests/adding_a_format.rs similarity index 96% rename from src/state/adding_a_format.rs rename to src/state/tests/adding_a_format.rs index 0f4ba0a02..b5e52d876 100644 --- a/src/state/adding_a_format.rs +++ b/src/state/tests/adding_a_format.rs @@ -44,8 +44,8 @@ use or_io::container::resource::ResourceType; use or_io::Generation; -use super::format_handlers::{self as formats, FormatHandler, FormatId, Tier}; -use super::{capabilities, kinds, payload_handlers, DocPayload, DocumentKind}; +use crate::state::format_handlers::{self as formats, FormatHandler, FormatId, Tier}; +use crate::state::{capabilities, kinds, payload_handlers, DocPayload, DocumentKind}; const EXTENSION: &str = "orsynthetic"; @@ -165,7 +165,7 @@ fn first_missing_rung() -> Option { let crypto: std::sync::Arc = std::sync::Arc::new(or_io::container::NoOpCryptoProvider::new()); - match super::document_io::parse_payload(&probe, kind, &[], crypto) { + match crate::state::document_io::parse_payload(&probe, kind, &[], crypto) { Ok(payload) if payload.kind() == kind => {} _ => return Some(Rung::Opens), } diff --git a/src/state/adding_particle_files_is_an_import.rs b/src/state/tests/adding_particle_files_is_an_import.rs similarity index 96% rename from src/state/adding_particle_files_is_an_import.rs rename to src/state/tests/adding_particle_files_is_an_import.rs index f2b7fd9a4..47e41f0c3 100644 --- a/src/state/adding_particle_files_is_an_import.rs +++ b/src/state/tests/adding_particle_files_is_an_import.rs @@ -7,9 +7,9 @@ use std::path::{Path, PathBuf}; use or_particles::Particles; -use super::front_door::{NewProject, Template}; use super::the_project_history::{open, until, write}; -use super::AppState; +use crate::state::front_door::{NewProject, Template}; +use crate::state::AppState; const SOURCE: &str = "fx_test.particles.src"; diff --git a/src/state/adding_weapons_is_an_import.rs b/src/state/tests/adding_weapons_is_an_import.rs similarity index 98% rename from src/state/adding_weapons_is_an_import.rs rename to src/state/tests/adding_weapons_is_an_import.rs index 8f9734206..4b2ea203d 100644 --- a/src/state/adding_weapons_is_an_import.rs +++ b/src/state/tests/adding_weapons_is_an_import.rs @@ -7,9 +7,9 @@ use std::path::{Path, PathBuf}; use or_weapons::Weapons; -use super::front_door::{NewProject, Template}; use super::the_project_history::{open, until, write}; -use super::AppState; +use crate::state::front_door::{NewProject, Template}; +use crate::state::AppState; const PISTOL: &str = r#" diff --git a/src/state/an_alt_click_in_the_viewport_picks_a_model.rs b/src/state/tests/an_alt_click_in_the_viewport_picks_a_model.rs similarity index 97% rename from src/state/an_alt_click_in_the_viewport_picks_a_model.rs rename to src/state/tests/an_alt_click_in_the_viewport_picks_a_model.rs index bffcd0550..30ab2188b 100644 --- a/src/state/an_alt_click_in_the_viewport_picks_a_model.rs +++ b/src/state/tests/an_alt_click_in_the_viewport_picks_a_model.rs @@ -3,9 +3,9 @@ use glam::Vec3; -use super::prefs::Prefs; use super::the_viewport_picks_what_it_draws::{a_triangle, camera, Holder}; -use super::{AppState, DocPayload}; +use crate::state::prefs::Prefs; +use crate::state::{AppState, DocPayload}; use crate::ui::panels::viewport::select_on_click; /// A primary click, with `modifiers` held, in the middle of a viewport that fills a screen of its diff --git a/src/state/an_awc_animation_is_written_back.rs b/src/state/tests/an_awc_animation_is_written_back.rs similarity index 99% rename from src/state/an_awc_animation_is_written_back.rs rename to src/state/tests/an_awc_animation_is_written_back.rs index d6fec9a85..84079d78f 100644 --- a/src/state/an_awc_animation_is_written_back.rs +++ b/src/state/tests/an_awc_animation_is_written_back.rs @@ -8,7 +8,7 @@ use or_io::container::rpf::{write_rpf9_resource, Rpf9Form}; use super::an_awc_stream_opens_its_animation::{adat, stored_set}; use super::opening_an_rpf9_archive::settle; -use super::*; +use crate::state::*; fn chunk(state: &mut AppState, doc: DocumentId) -> Vec { let file = state.awc_file(doc).expect("its container"); diff --git a/src/state/an_awc_stream_opens_its_animation.rs b/src/state/tests/an_awc_stream_opens_its_animation.rs similarity index 92% rename from src/state/an_awc_stream_opens_its_animation.rs rename to src/state/tests/an_awc_stream_opens_its_animation.rs index 1e9214747..a7b4d79c5 100644 --- a/src/state/an_awc_stream_opens_its_animation.rs +++ b/src/state/tests/an_awc_stream_opens_its_animation.rs @@ -2,7 +2,7 @@ //! `rpf scan-open` reads it. /// A lone animation set named `dict_a` with no animation, stored whole in an RSC8 of version 65. -pub(super) fn stored_set() -> Vec { +pub(in crate::state) fn stored_set() -> Vec { let mut root = vec![0u8; 0xC0]; root[0x38..0x3E].copy_from_slice(b"dict_a"); root[0x47] = 0x80 | 6; @@ -19,7 +19,7 @@ pub(super) fn stored_set() -> Vec { } /// An `ADAT` container of one stream, id 0x123, whose one chunk is `animation`. -pub(super) fn adat(animation: &[u8]) -> Vec { +pub(in crate::state) fn adat(animation: &[u8]) -> Vec { let tables = 16 + 4 + 8; let mut bytes = b"ADAT".to_vec(); bytes.extend(1u16.to_le_bytes()); diff --git a/src/state/an_edit_of_the_wardrobe_is_a_step_of_undo.rs b/src/state/tests/an_edit_of_the_wardrobe_is_a_step_of_undo.rs similarity index 98% rename from src/state/an_edit_of_the_wardrobe_is_a_step_of_undo.rs rename to src/state/tests/an_edit_of_the_wardrobe_is_a_step_of_undo.rs index fbe95ff78..482be41cd 100644 --- a/src/state/an_edit_of_the_wardrobe_is_a_step_of_undo.rs +++ b/src/state/tests/an_edit_of_the_wardrobe_is_a_step_of_undo.rs @@ -11,9 +11,9 @@ use or_wardrobe::edit::Edit; use or_wardrobe::{Component, Ped, Slot, Wardrobe}; use super::the_wardrobe_workspace::{drop_files, garments, opened, until, C}; -use super::toasts::ToastAction; -use super::workbench::{Choice, Finding, Fix, Missing, Place, Question}; -use super::AppState; +use crate::state::toasts::ToastAction; +use crate::state::workbench::{Choice, Finding, Fix, Missing, Place, Question}; +use crate::state::AppState; /// The pack of the clothing shown, as the last scan read it. fn pack(state: &AppState) -> Wardrobe { @@ -428,7 +428,7 @@ fn a_refused_undo_of_a_drop_keeps_the_drop_and_the_removal_of_its_garment_on_the state .toasts .iter() - .any(|t| t.toast_type == super::toasts::ToastType::Error), + .any(|t| t.toast_type == crate::state::toasts::ToastType::Error), "the refusal is said" ); assert_eq!( diff --git a/src/state/an_edit_stays_where_it_was_made.rs b/src/state/tests/an_edit_stays_where_it_was_made.rs similarity index 92% rename from src/state/an_edit_stays_where_it_was_made.rs rename to src/state/tests/an_edit_stays_where_it_was_made.rs index bb0fb23b7..d03a80460 100644 --- a/src/state/an_edit_stays_where_it_was_made.rs +++ b/src/state/tests/an_edit_stays_where_it_was_made.rs @@ -12,10 +12,10 @@ use or_test_support::{skip_corpus, Corpus}; use super::nested_archives_survive_a_save::save; use super::opening_a_ydd::finish_load; -use super::{drawable_mut, AppState, Change, DocumentId}; +use crate::state::{drawable_mut, AppState, Change, DocumentId}; /// `path` opened as Open File opens it. -pub(super) fn open(state: &mut AppState, path: &Path) -> DocumentId { +pub(in crate::state) fn open(state: &mut AppState, path: &Path) -> DocumentId { state.load_file(path.to_path_buf()); finish_load(state).unwrap_or_else(|e| panic!("{}: {e}", path.display())) } @@ -45,7 +45,7 @@ fn material_value(drawable: &RmcDrawable, (shader, entry): (usize, usize)) } /// The smallest staged Legacy drawable whose materials carry a float, copied where a save may write it. -pub(super) fn drawable_with_a_material(dir: &Path) -> Option<(PathBuf, (usize, usize))> { +pub(in crate::state) fn drawable_with_a_material(dir: &Path) -> Option<(PathBuf, (usize, usize))> { let mut files = Corpus::new(env!("CARGO_MANIFEST_DIR"), "ydr").find(); files.sort_by_key(|p| std::fs::metadata(p).map_or(u64::MAX, |m| m.len())); files.into_iter().find_map(|source| { @@ -58,13 +58,13 @@ pub(super) fn drawable_with_a_material(dir: &Path) -> Option<(PathBuf, (usize, u } /// The row of the drawable `doc`'s grid whose label ends with `ending`: its label and its edit. -pub(super) fn grid_row( +pub(in crate::state) fn grid_row( state: &AppState, doc: DocumentId, ending: &str, ) -> (String, or_editor::Edit) { let doc = state.document(doc).expect("open"); - let (pack, root) = super::described_root(doc).expect("a drawable is described"); + let (pack, root) = crate::state::described_root(doc).expect("a drawable is described"); let image = doc.resource.as_ref().expect("the image it was read from"); let summary = or_editor::Summary::of(&pack, &root, image.view(), 0).expect("a summary"); let row = (summary.rows.iter()) @@ -74,7 +74,7 @@ pub(super) fn grid_row( } /// Add 1.5 to the material value at `at`, as the material editor's Set does, and return what it holds now. -pub(super) fn edit_a_material( +pub(in crate::state) fn edit_a_material( state: &mut AppState, doc: DocumentId, (shader, entry): (usize, usize), @@ -171,13 +171,13 @@ fn an_undone_grid_edit_is_not_written_by_a_later_save() { /// The inspector drawn frame by frame, and what a user clicks and drags in it. #[derive(Default)] -pub(super) struct Inspector { +pub(in crate::state) struct Inspector { ctx: egui::Context, time: f64, } impl Inspector { - pub(super) fn frame( + pub(in crate::state) fn frame( &mut self, state: &mut AppState, events: Vec, @@ -198,7 +198,7 @@ impl Inspector { } /// A drag of `by` points to the right across the value on the row labelled `label`. - pub(super) fn drag(&mut self, state: &mut AppState, label: &str, by: f32) { + pub(in crate::state) fn drag(&mut self, state: &mut AppState, label: &str, by: f32) { let to = self.press(state, label) + egui::vec2(by, 0.0); self.move_to(state, to); self.release(state, to); @@ -226,7 +226,12 @@ impl Inspector { } /// A click of `button` where the inspector paints `text`. - pub(super) fn click(&mut self, state: &mut AppState, text: &str, button: egui::PointerButton) { + pub(in crate::state) fn click( + &mut self, + state: &mut AppState, + text: &str, + button: egui::PointerButton, + ) { let shapes = self.frame(state, Vec::new()); let at = (texts(&shapes).into_iter()) .find(|(painted, _)| painted == text) @@ -258,7 +263,7 @@ fn value_beside(shapes: &[ClippedShape], label: &str) -> Option { } /// Every text egui painted, and the rectangle it covers. -pub(super) fn texts(shapes: &[ClippedShape]) -> Vec<(String, egui::Rect)> { +pub(in crate::state) fn texts(shapes: &[ClippedShape]) -> Vec<(String, egui::Rect)> { fn walk(shape: &egui::Shape, out: &mut Vec<(String, egui::Rect)>) { match shape { egui::Shape::Text(t) => { diff --git a/src/state/an_error_names_what_failed.rs b/src/state/tests/an_error_names_what_failed.rs similarity index 94% rename from src/state/an_error_names_what_failed.rs rename to src/state/tests/an_error_names_what_failed.rs index 0b21dba1b..d9f395ea7 100644 --- a/src/state/an_error_names_what_failed.rs +++ b/src/state/tests/an_error_names_what_failed.rs @@ -1,6 +1,6 @@ //! An error's title says which operation failed. -use super::{AppState, LoadResult, SaveResult}; +use crate::state::{AppState, LoadResult, SaveResult}; /// Every label a frame of the editor's overlays draws. fn overlays(state: &mut AppState) -> Vec { @@ -33,7 +33,7 @@ fn a_failed_save_is_titled_as_a_save_and_a_failed_open_as_an_open() { let mut state = AppState::default(); let (tx, receiver) = std::sync::mpsc::channel(); - state.save_receiver = Some(super::file_io::SaveJob { + state.save_receiver = Some(crate::state::file_io::SaveJob { path: "vehicle.ydr".into(), cancel: or_job::Cancel::new(), receiver, diff --git a/src/state/an_export_asks_before_it_alters_the_bytes.rs b/src/state/tests/an_export_asks_before_it_alters_the_bytes.rs similarity index 91% rename from src/state/an_export_asks_before_it_alters_the_bytes.rs rename to src/state/tests/an_export_asks_before_it_alters_the_bytes.rs index 247af68d4..c8168375b 100644 --- a/src/state/an_export_asks_before_it_alters_the_bytes.rs +++ b/src/state/tests/an_export_asks_before_it_alters_the_bytes.rs @@ -11,11 +11,11 @@ use or_io::container::rpf::BodyForm; use or_io::gta5::text::Gxt2; use or_io::gta5::File as _; -use super::document::{Document, DocumentId, RpfNodeId}; -use super::extract_job::{ExtractStart, TypeFilter}; -use super::prefs::{EditMode, ExportFixes}; -use super::rpf_session::{RpfDocument, RpfEditSession}; -use super::{AppState, DocPayload}; +use crate::state::document::{Document, DocumentId, RpfNodeId}; +use crate::state::extract_job::{ExtractStart, TypeFilter}; +use crate::state::prefs::{EditMode, ExportFixes}; +use crate::state::rpf_session::{RpfDocument, RpfEditSession}; +use crate::state::{AppState, DocPayload}; /// A table as OpenRage writes it. fn canonical_gxt2() -> Vec { diff --git a/src/state/an_extraction_holds_back_only_the_files_it_reads.rs b/src/state/tests/an_extraction_holds_back_only_the_files_it_reads.rs similarity index 97% rename from src/state/an_extraction_holds_back_only_the_files_it_reads.rs rename to src/state/tests/an_extraction_holds_back_only_the_files_it_reads.rs index ad38644a0..bdda20502 100644 --- a/src/state/an_extraction_holds_back_only_the_files_it_reads.rs +++ b/src/state/tests/an_extraction_holds_back_only_the_files_it_reads.rs @@ -9,11 +9,11 @@ use or_io::container::rpf::BodyForm; use super::a_rename_on_disk_waits_for_the_extraction_reading_it::{ counted, sub_of_unopened_archives, }; -use super::extract_job::{ExtractStart, TypeFilter}; use super::nested_archives_survive_a_save::errors; use super::nothing_extracts_into_an_install::{files_under, run_to_completion}; use super::opening_a_ydd::node_at; -use super::{AppState, DocumentId, RpfNodeId}; +use crate::state::extract_job::{ExtractStart, TypeFilter}; +use crate::state::{AppState, DocumentId, RpfNodeId}; fn told(state: &AppState, what: &str) -> bool { state.toasts.iter().any(|t| t.message.contains(what)) @@ -95,7 +95,7 @@ fn an_undo_writing_under_an_extraction_still_opening_its_rows_waits_for_it() { #[test] fn a_mod_does_not_move_under_an_extraction_still_opening_its_rows() { use super::every_add_lands_where_the_tree_shows_it::opened; - use super::{EditMode, Game}; + use crate::state::{EditMode, Game}; let dir = tempfile::tempdir().expect("a scratch directory"); let sub = dir.path().join("mods").join("sub"); std::fs::create_dir_all(&sub).expect("the folders"); @@ -191,7 +191,7 @@ fn a_folder_mended_after_a_drag_told_it_would_not_list_is_opened_by_the_next_dra /// counting again by every menu that opens, and each click would toast the same failure. #[test] fn a_folder_the_count_could_not_list_is_told_once_and_left_out_of_the_unread_count() { - use super::extract_planning::Counting; + use crate::state::extract_planning::Counting; let dir = tempfile::tempdir().expect("a scratch directory"); let gone = dir.path().join("mods").join("sub").join("gone"); std::fs::create_dir_all(&gone).expect("the folder"); @@ -231,7 +231,7 @@ fn a_folder_the_count_could_not_list_is_told_once_and_left_out_of_the_unread_cou /// `census_of` was its tick: closed mid-count, it was parked with rows in flight. #[test] fn a_count_goes_on_while_the_submenu_that_started_it_is_closed() { - use super::extract_planning::Counting; + use crate::state::extract_planning::Counting; let dir = tempfile::tempdir().expect("a scratch directory"); let (mut state, doc, row) = sub_of_unopened_archives( dir.path(), @@ -259,7 +259,7 @@ fn a_count_goes_on_while_the_submenu_that_started_it_is_closed() { /// the list says so, and its Cancel stops the opening, which the drag's toast says nothing of. #[test] fn a_drag_out_opening_its_rows_is_in_the_jobs_list_and_its_cancel_stops_it() { - use super::jobs::JobKind; + use crate::state::jobs::JobKind; let dir = tempfile::tempdir().expect("a scratch directory"); let (mut state, doc, row) = sub_of_unopened_archives(dir.path(), &[("one.txt", b"one".to_vec())]); diff --git a/src/state/an_import_ends_with_a_toast_that_says_what_was_done_and_takes_it_back.rs b/src/state/tests/an_import_ends_with_a_toast_that_says_what_was_done_and_takes_it_back.rs similarity index 98% rename from src/state/an_import_ends_with_a_toast_that_says_what_was_done_and_takes_it_back.rs rename to src/state/tests/an_import_ends_with_a_toast_that_says_what_was_done_and_takes_it_back.rs index 35a6a20d7..e8e94146e 100644 --- a/src/state/an_import_ends_with_a_toast_that_says_what_was_done_and_takes_it_back.rs +++ b/src/state/tests/an_import_ends_with_a_toast_that_says_what_was_done_and_takes_it_back.rs @@ -6,8 +6,8 @@ use or_source::asset::folder_name; use or_source::textures; use super::importing_game_files_from_the_app::{imported, project, sources_of, write, ytd}; -use super::toasts::ToastAction; -use super::AppState; +use crate::state::toasts::ToastAction; +use crate::state::AppState; /// The toast with an Undo import button, as its message and the action it carries. fn offered(state: &AppState) -> Option<(String, ToastAction)> { diff --git a/src/state/an_undo_finishes_or_says_why.rs b/src/state/tests/an_undo_finishes_or_says_why.rs similarity index 99% rename from src/state/an_undo_finishes_or_says_why.rs rename to src/state/tests/an_undo_finishes_or_says_why.rs index a568a0ddb..cb41551b0 100644 --- a/src/state/an_undo_finishes_or_says_why.rs +++ b/src/state/tests/an_undo_finishes_or_says_why.rs @@ -9,12 +9,12 @@ use super::copy_cut_and_paste::{forget_offered, names_under}; use super::every_add_lands_where_the_tree_shows_it::opened; use super::nested_archives_survive_a_save::{archive, errors, save}; use super::opening_a_ydd::node_at; -use super::prefs::EditMode; use super::the_files_view_in_the_centre::{accessible, frame}; use super::two_readers_of_one_archive_across_a_save::install; use super::undo_from_files_acts_on_what_files_shows::name_of; -use super::{AppState, DocPayload, DocumentId, EditHistory, RetailEditDecision, RpfNodeId}; use crate::platform::{clipboard::fake, recycle_bin}; +use crate::state::prefs::EditMode; +use crate::state::{AppState, DocPayload, DocumentId, EditHistory, RetailEditDecision, RpfNodeId}; use crate::ui::commands; /// Every row of `doc`'s tree by its path, and the archives in it marked unsaved. diff --git a/src/state/applying_a_preset.rs b/src/state/tests/applying_a_preset.rs similarity index 98% rename from src/state/applying_a_preset.rs rename to src/state/tests/applying_a_preset.rs index 350e47901..9dd93c905 100644 --- a/src/state/applying_a_preset.rs +++ b/src/state/tests/applying_a_preset.rs @@ -1,7 +1,7 @@ //! A preset saved from one metadata record, applied to a selection of a hundred. -use super::presets::{MetaStep, PresetLibrary, PRESET_VERSION}; -use super::*; +use crate::state::presets::{MetaStep, PresetLibrary, PRESET_VERSION}; +use crate::state::*; use or_io::meta::{MetaInstance, Value}; const RECORDS: usize = 100; diff --git a/src/state/authoring.rs b/src/state/tests/authoring.rs similarity index 100% rename from src/state/authoring.rs rename to src/state/tests/authoring.rs diff --git a/src/state/building_a_dlc_pack_from_the_app.rs b/src/state/tests/building_a_dlc_pack_from_the_app.rs similarity index 99% rename from src/state/building_a_dlc_pack_from_the_app.rs rename to src/state/tests/building_a_dlc_pack_from_the_app.rs index d458daf20..1ac9ac8c9 100644 --- a/src/state/building_a_dlc_pack_from_the_app.rs +++ b/src/state/tests/building_a_dlc_pack_from_the_app.rs @@ -5,12 +5,12 @@ use std::path::{Path, PathBuf}; use std::time::{Duration, Instant}; -use super::jobs::JobKind; use super::the_files_view_in_the_centre::{ accessible, click, click_with, find, frame, leaf_of, listed, settled, }; -use super::{AppState, EditMode, Game, Prefs}; +use crate::state::jobs::JobKind; use crate::state::panel_ids as ids; +use crate::state::{AppState, EditMode, Game, Prefs}; const DEADLINE: Duration = Duration::from_secs(60); const LINE: &str = "dlcpacks:/mypack/"; diff --git a/src/state/building_targets_from_the_app.rs b/src/state/tests/building_targets_from_the_app.rs similarity index 98% rename from src/state/building_targets_from_the_app.rs rename to src/state/tests/building_targets_from_the_app.rs index 2705037c5..934672e9e 100644 --- a/src/state/building_targets_from_the_app.rs +++ b/src/state/tests/building_targets_from_the_app.rs @@ -12,8 +12,8 @@ use or_io::gta5::gen8::GrcTexture; use or_io::gta5::PgDictionary; use or_project::{Container, Output, OutputKind, Project, Target}; -use super::workbench::{BuildDot, LastBuild}; -use super::{AppState, Prefs}; +use crate::state::workbench::{BuildDot, LastBuild}; +use crate::state::{AppState, Prefs}; fn write(path: &Path, body: &[u8]) { std::fs::create_dir_all(path.parent().unwrap()).unwrap(); diff --git a/src/state/comparing_every_resource_and_archive.rs b/src/state/tests/comparing_every_resource_and_archive.rs similarity index 96% rename from src/state/comparing_every_resource_and_archive.rs rename to src/state/tests/comparing_every_resource_and_archive.rs index a0fa9f02b..ede85b2e2 100644 --- a/src/state/comparing_every_resource_and_archive.rs +++ b/src/state/tests/comparing_every_resource_and_archive.rs @@ -19,27 +19,33 @@ use or_io::gta5::{ }; use or_test_support::{skip_install, GAME_ROOT_ENV}; -use super::compare::{By, Change, Comparison}; use super::comparing_two_files::{command, fields, run, shown, state}; use super::defragmenting_an_archive::{fragmented, settle}; -use super::document_io::serialize_archive_records; -use super::jobs::JobKind; use super::nested_archives_survive_a_save::archive as archive_bytes; use super::opening_a_ydd::{node_at, with_keys}; -use super::prefs::RpfOutputMode; use super::what_a_comparison_still_missed::install_roots; -use super::{AppState, DocPayload, DocumentKind}; +use crate::state::compare::{By, Change, Comparison}; +use crate::state::document_io::serialize_archive_records; +use crate::state::jobs::JobKind; +use crate::state::prefs::RpfOutputMode; +use crate::state::{AppState, DocPayload, DocumentKind}; use crate::ui::commands::Action; /// A changed field as the tab lists it: where, which field, how, and both values. -pub(super) type Row = (String, String, Change, String, String); - -pub(super) fn row(record: &str, field: &str, change: Change, left: &str, right: &str) -> Row { +pub(in crate::state) type Row = (String, String, Change, String, String); + +pub(in crate::state) fn row( + record: &str, + field: &str, + change: Change, + left: &str, + right: &str, +) -> Row { let text = |s: &str| s.to_string(); (text(record), text(field), change, text(left), text(right)) } -pub(super) fn rows(comparison: &Comparison) -> Vec { +pub(in crate::state) fn rows(comparison: &Comparison) -> Vec { let (_, changes) = fields(comparison); (changes.into_iter()) .map(|c| (c.record, c.field, c.change, c.left, c.right)) @@ -47,7 +53,7 @@ pub(super) fn rows(comparison: &Comparison) -> Vec { } /// `a` and `b`, files of a scratch folder, compared from their rows' menus: the tab that opens. -pub(super) fn compare_files(a: (&str, &[u8]), b: (&str, &[u8])) -> (Comparison, String) { +pub(in crate::state) fn compare_files(a: (&str, &[u8]), b: (&str, &[u8])) -> (Comparison, String) { let dir = tempfile::tempdir().expect("a scratch folder"); std::fs::write(dir.path().join(a.0), a.1).expect("the first file"); std::fs::write(dir.path().join(b.0), b.1).expect("the second file"); @@ -63,7 +69,7 @@ pub(super) fn compare_files(a: (&str, &[u8]), b: (&str, &[u8])) -> (Comparison, shown(&state) } -pub(super) fn drawable(name: &str, distance: f32, radius: f32) -> GtaDrawable { +pub(in crate::state) fn drawable(name: &str, distance: f32, radius: f32) -> GtaDrawable { let mut d = GtaDrawable::::default(); d.base.name = name.to_string(); d.base.lod_group.lod_distances[0] = distance; @@ -71,12 +77,12 @@ pub(super) fn drawable(name: &str, distance: f32, radius: f32) -> GtaDrawable) -> Vec { +pub(in crate::state) fn saved(d: &GtaDrawable) -> Vec { d.to_bytes().expect("a drawable saves") } /// A drawable whose first level of detail holds one model for each of `flags`. -pub(super) fn with_models(flags: &[u8]) -> Vec { +pub(in crate::state) fn with_models(flags: &[u8]) -> Vec { let models = (flags.iter()) .map(|&flags| { let model = GrmModel:: { @@ -307,7 +313,7 @@ fn a_blob_that_changes_length_is_one_row_and_not_also_a_row_for_its_run() { } /// A quad whose two triangles are of the materials `surface` names, the second being `last`. -pub(super) fn quad_mesh(surface: [u8; 2], last: [u16; 3]) -> BoundMesh { +pub(in crate::state) fn quad_mesh(surface: [u8; 2], last: [u16; 3]) -> BoundMesh { let corner = |x: f32, y: f32| [x, y, 0.0]; let mut mesh = BoundMesh::new( vec![ @@ -677,7 +683,7 @@ fn a_cancel_from_the_job_list_tells_the_comparison_running_to_stop() { std::thread::sleep(Duration::from_millis(5)); } let _ = told.send(stop.load(Ordering::Relaxed)); - super::compare::Ended::Failed("stopped".into()) + crate::state::compare::Ended::Failed("stopped".into()) }); let compare_running = |state: &AppState| (state.running_jobs().iter()).any(|job| job.kind == JobKind::Compare); diff --git a/src/state/comparing_two_files.rs b/src/state/tests/comparing_two_files.rs similarity index 95% rename from src/state/comparing_two_files.rs rename to src/state/tests/comparing_two_files.rs index 714b7ca6c..282875e9a 100644 --- a/src/state/comparing_two_files.rs +++ b/src/state/tests/comparing_two_files.rs @@ -7,18 +7,18 @@ use std::time::{Duration, Instant}; use or_io::meta::{MetaInstance, Value}; -use super::compare::{By, Change, Comparison, FieldChange, Found}; -use super::jobs::JobKind; use super::opening_a_ydd::node_at; -use super::{AppState, DocPayload, DocumentId, DocumentKind, Prefs, RpfNodeId}; +use crate::state::compare::{By, Change, Comparison, FieldChange, Found}; +use crate::state::jobs::JobKind; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind, Prefs, RpfNodeId}; use crate::ui::commands::{self, Action, Target}; -pub(super) fn state() -> AppState { +pub(in crate::state) fn state() -> AppState { AppState::from_prefs(Prefs::default()) } /// The command `action` on `row` of `doc`, as the row's menu offers it. -pub(super) fn command( +pub(in crate::state) fn command( state: &AppState, action: Action, doc: DocumentId, @@ -29,7 +29,7 @@ pub(super) fn command( } /// Run `action` on `row` of `doc` from its menu, and wait for the comparison it starts. -pub(super) fn run(state: &mut AppState, action: Action, doc: DocumentId, row: RpfNodeId) { +pub(in crate::state) fn run(state: &mut AppState, action: Action, doc: DocumentId, row: RpfNodeId) { let command = command(state, action, doc, row); assert_eq!(command.enabled, Ok(()), "{action:?} is not offered"); commands::run(state, &egui::Context::default(), &command); @@ -46,7 +46,7 @@ pub(super) fn run(state: &mut AppState, action: Action, doc: DocumentId, row: Rp } /// The comparison the active tab shows, and its tab's title. -pub(super) fn shown(state: &AppState) -> (Comparison, String) { +pub(in crate::state) fn shown(state: &AppState) -> (Comparison, String) { let doc = state.active_document().expect("a document is active"); assert_eq!( doc.kind(), @@ -63,7 +63,7 @@ pub(super) fn shown(state: &AppState) -> (Comparison, String) { (compared.clone(), state.tab_title(doc)) } -pub(super) fn fields(compared: &Comparison) -> (By, Vec) { +pub(in crate::state) fn fields(compared: &Comparison) -> (By, Vec) { match &compared.found { Found::Fields { by, changes, .. } => (*by, changes.clone()), other => panic!("not compared field by field: {other:?}"), @@ -104,7 +104,7 @@ fn a_ymt_with_records() -> Option { let Some(format) = or_io::meta::detect_binary_format(&bytes) else { continue; }; - let doc = super::MetaDocument::from_bytes(bytes.clone()); + let doc = crate::state::MetaDocument::from_bytes(bytes.clone()); let Some(parsed) = doc.parsed else { continue; }; @@ -278,7 +278,7 @@ fn a_dictionary() -> Option<( } /// An unencrypted archive holding `files`, written at `path`. -pub(super) fn archive(path: &Path, files: &[(&str, &[u8])]) { +pub(in crate::state) fn archive(path: &Path, files: &[(&str, &[u8])]) { use or_io::container::rpf::RpfBuilder; let mut builder = RpfBuilder::default(); for (inner, bytes) in files { diff --git a/src/state/converting_from_the_app.rs b/src/state/tests/converting_from_the_app.rs similarity index 93% rename from src/state/converting_from_the_app.rs rename to src/state/tests/converting_from_the_app.rs index 883a8a5e9..70f808ff6 100644 --- a/src/state/converting_from_the_app.rs +++ b/src/state/tests/converting_from_the_app.rs @@ -19,14 +19,14 @@ use serde_json::Value; use super::the_files_view_in_the_centre::{ accessible, click, click_with, find, frame, leaf_of, listed, settled, }; -use super::{AppState, Prefs}; use crate::state::panel_ids as ids; +use crate::state::{AppState, Prefs}; const MANIFEST: &str = env!("CARGO_MANIFEST_DIR"); const DEADLINE: Duration = Duration::from_secs(120); /// A shader database assembled from the staged `.fxc` effects, which may be none. -pub(super) fn database() -> ShaderDefinitions { +pub(in crate::state) fn database() -> ShaderDefinitions { let effects: Vec<(String, GrcEffect)> = (Corpus::new(MANIFEST, "fxc").find().iter()) .filter_map(|path| { let stem = path.file_stem()?.to_string_lossy().into_owned(); @@ -41,7 +41,7 @@ pub(super) fn database() -> ShaderDefinitions { /// /// ⚠ A report the database does not change would match the command's even /// if the app converted with no database at all. -pub(super) fn staged(target: &str, remap: &ParamRemap) -> Option { +pub(in crate::state) fn staged(target: &str, remap: &ParamRemap) -> Option { let mut files = Corpus::new(MANIFEST, "ydr").target(target).find(); files.sort_by_key(|p| std::fs::metadata(p).map(|m| m.len()).unwrap_or(u64::MAX)); let report = |path: &Path, remap: &ParamRemap| { @@ -57,7 +57,7 @@ pub(super) fn staged(target: &str, remap: &ParamRemap) -> Option { } /// What `openrage-cli convert retarget` reports for the one file in `input`, writing into `out`. -pub(super) fn clis_entry(input: &Path, out: &Path, defs: &Path) -> Value { +pub(in crate::state) fn clis_entry(input: &Path, out: &Path, defs: &Path) -> Value { let mut words = vec!["convert".to_string(), "retarget".to_string()]; for word in [ input, @@ -80,7 +80,7 @@ pub(super) fn clis_entry(input: &Path, out: &Path, defs: &Path) -> Value { } /// `input` open as a folder in Browse, converting with `remap`. -pub(super) fn browsing(input: &Path, remap: &ParamRemap) -> (AppState, egui::Context) { +pub(in crate::state) fn browsing(input: &Path, remap: &ParamRemap) -> (AppState, egui::Context) { let mut state = AppState::from_prefs(Prefs::default()); state.prefs.explorer = Default::default(); state.shader_defs.remap = Arc::new(remap.clone()); @@ -96,7 +96,7 @@ pub(super) fn browsing(input: &Path, remap: &ParamRemap) -> (AppState, egui::Con } /// Opens row `name`'s menu in the Files view, clicks `item` in it, and waits for the question. -pub(super) fn convert_from_the_menu( +pub(in crate::state) fn convert_from_the_menu( ctx: &egui::Context, state: &mut AppState, name: &str, @@ -119,7 +119,7 @@ pub(super) fn convert_from_the_menu( } /// One frame of the questions alone on a 1600 by 900 screen, with `events`. -pub(super) fn question_frame( +pub(in crate::state) fn question_frame( ctx: &egui::Context, state: &mut AppState, events: Vec, @@ -128,7 +128,7 @@ pub(super) fn question_frame( } /// One frame of the questions alone on a screen of `size`, with `events`. -pub(super) fn question_frame_on( +pub(in crate::state) fn question_frame_on( ctx: &egui::Context, state: &mut AppState, size: egui::Vec2, @@ -145,12 +145,12 @@ pub(super) fn question_frame_on( } /// Each labelled widget `output` laid out and where; a label's text runs are part of it and are left out. -pub(super) fn question_labels(output: &egui::FullOutput) -> Vec<(String, egui::Rect)> { +pub(in crate::state) fn question_labels(output: &egui::FullOutput) -> Vec<(String, egui::Rect)> { laid_out(output, |role| role != egui::accesskit::Role::TextRun) } /// Each row of text `output` laid out and where: a label that wraps is one row for each line it takes. -pub(super) fn question_rows(output: &egui::FullOutput) -> Vec<(String, egui::Rect)> { +pub(in crate::state) fn question_rows(output: &egui::FullOutput) -> Vec<(String, egui::Rect)> { laid_out(output, |role| role == egui::accesskit::Role::TextRun) } @@ -196,7 +196,11 @@ fn report_lines_shown(output: &egui::FullOutput, name: &str) -> Vec { /// The report the question shows, which begins with the first file's name: its line, then a line for each value it drops, indented. /// /// ⚠ Scrolled a page at a time to the end, since the report's area clips what does not fit. -pub(super) fn shown_report(ctx: &egui::Context, state: &mut AppState, name: &str) -> String { +pub(in crate::state) fn shown_report( + ctx: &egui::Context, + state: &mut AppState, + name: &str, +) -> String { for _ in 0..2 { question_frame(ctx, state, Vec::new()); } @@ -242,7 +246,7 @@ pub(super) fn shown_report(ctx: &egui::Context, state: &mut AppState, name: &str } /// Each button the question draws, and whether it can be clicked. -pub(super) fn buttons(ctx: &egui::Context, state: &mut AppState) -> Vec<(String, bool)> { +pub(in crate::state) fn buttons(ctx: &egui::Context, state: &mut AppState) -> Vec<(String, bool)> { let input = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size( egui::Pos2::ZERO, @@ -262,7 +266,7 @@ pub(super) fn buttons(ctx: &egui::Context, state: &mut AppState) -> Vec<(String, .collect() } -pub(super) fn written_by_the_job(state: &mut AppState) { +pub(in crate::state) fn written_by_the_job(state: &mut AppState) { let until = Instant::now() + DEADLINE; while state.extract_jobs.is_running() && Instant::now() < until { state.poll_extract_job(); @@ -311,7 +315,7 @@ fn a_drawable_converts_from_its_menu_and_its_report_equals_the_clis() { .report .0 .iter() - .map(super::convert_words::dropped) + .map(crate::state::convert_words::dropped) .collect(); let (mut state, ctx) = browsing(&input, &remap); diff --git a/src/state/converting_in_a_modders_words.rs b/src/state/tests/converting_in_a_modders_words.rs similarity index 99% rename from src/state/converting_in_a_modders_words.rs rename to src/state/tests/converting_in_a_modders_words.rs index fbaa17959..74a746f03 100644 --- a/src/state/converting_in_a_modders_words.rs +++ b/src/state/tests/converting_in_a_modders_words.rs @@ -15,20 +15,20 @@ use or_io::Generation; use or_test_support::{skip_corpus, Corpus, TARGET_GEN8, TARGET_GEN9}; use serde_json::Value; -use super::convert_words; use super::converting_from_the_app::{ browsing, buttons, clis_entry, convert_from_the_menu, database, shown_report, staged, written_by_the_job, }; -use super::jobs::JobKind; use super::the_files_view_in_the_centre::{accessible, click, find, labels, node, settled}; -use super::{AppState, DocumentId, Prefs}; +use crate::state::convert_words; +use crate::state::jobs::JobKind; +use crate::state::{AppState, DocumentId, Prefs}; const MANIFEST: &str = env!("CARGO_MANIFEST_DIR"); const DEADLINE: Duration = Duration::from_secs(120); fn file_name(path: &Path) -> String { - super::jobs::file_name(path) + crate::state::jobs::file_name(path) } /// The words of `text` that join names with `_`, `.` or `/`, or run a lower-case name into its number, as the declarations name a place or a field. diff --git a/src/state/converting_is_listed_and_asked_inside_its_panel.rs b/src/state/tests/converting_is_listed_and_asked_inside_its_panel.rs similarity index 98% rename from src/state/converting_is_listed_and_asked_inside_its_panel.rs rename to src/state/tests/converting_is_listed_and_asked_inside_its_panel.rs index 5ae707614..a512cae30 100644 --- a/src/state/converting_is_listed_and_asked_inside_its_panel.rs +++ b/src/state/tests/converting_is_listed_and_asked_inside_its_panel.rs @@ -9,16 +9,16 @@ use or_interchange::Scene; use or_io::gta5::shaders::shader_defs::ParamRemap; use or_io::gta5::{gen8::GrcTexture, File as _, PgDictionary}; -use super::convert_words; use super::converting_from_the_app::{ browsing, convert_from_the_menu, question_frame, question_frame_on, question_labels, question_rows, written_by_the_job, }; use super::every_write_asks_the_jobs_reading_it::exported; -use super::jobs::{JobKind, Outcome}; use super::one_place_for_background_jobs::{click as click_in_the_list, frame as the_status_bar}; use super::the_files_view_in_the_centre::{accessible, node}; -use super::{AppState, DocPayload, Document, Prefs}; +use crate::state::convert_words; +use crate::state::jobs::{JobKind, Outcome}; +use crate::state::{AppState, DocPayload, Document, Prefs}; use crate::ui::commands::{self, Action}; use crate::ui::panels::file_prompts::QUESTION_WIDTH; @@ -139,7 +139,7 @@ fn cancelling_an_exports_write_stops_it_and_never_stops_an_extraction() { } /// A Legacy `.ytd` of one texture called `name`, whose conversion drops a few words. -pub(super) fn a_ytd_holding(name: &str) -> PgDictionary { +pub(in crate::state) fn a_ytd_holding(name: &str) -> PgDictionary { let mut dictionary = PgDictionary::::default(); dictionary.insert(GrcTexture { name: name.to_string(), diff --git a/src/state/copy_cut_and_paste/fields.rs b/src/state/tests/copy_cut_and_paste/fields.rs similarity index 100% rename from src/state/copy_cut_and_paste/fields.rs rename to src/state/tests/copy_cut_and_paste/fields.rs diff --git a/src/state/copy_cut_and_paste/files.rs b/src/state/tests/copy_cut_and_paste/files.rs similarity index 99% rename from src/state/copy_cut_and_paste/files.rs rename to src/state/tests/copy_cut_and_paste/files.rs index 73a98cb2c..0250bce21 100644 --- a/src/state/copy_cut_and_paste/files.rs +++ b/src/state/tests/copy_cut_and_paste/files.rs @@ -5,11 +5,11 @@ use or_io::container::rpf::BodyForm; use super::super::nested_archives_survive_a_save::{archive, body, errors, on_disk, save}; use super::super::opening_a_ydd::{finish_load, node_at}; -use super::super::prefs::EditMode; use super::super::two_readers_of_one_archive_across_a_save::install; -use super::super::RetailEditDecision; use super::*; use crate::platform::{clipboard::fake, recycle_bin}; +use crate::state::prefs::EditMode; +use crate::state::RetailEditDecision; fn root_of(state: &AppState, doc: DocumentId) -> RpfNodeId { match state.document(doc).map(|d| &d.payload) { diff --git a/src/state/copy_cut_and_paste/mod.rs b/src/state/tests/copy_cut_and_paste/mod.rs similarity index 85% rename from src/state/copy_cut_and_paste/mod.rs rename to src/state/tests/copy_cut_and_paste/mod.rs index 18eb8120b..c97d0115b 100644 --- a/src/state/copy_cut_and_paste/mod.rs +++ b/src/state/tests/copy_cut_and_paste/mod.rs @@ -10,7 +10,7 @@ mod records; use std::path::{Path, PathBuf}; use super::every_add_lands_where_the_tree_shows_it::opened; -use super::{AppState, DocPayload, DocumentId, RpfNodeId}; +use crate::state::{AppState, DocPayload, DocumentId, RpfNodeId}; /// `files` written into a new folder `mods` under `root`, opened with Open Folder. fn folder_of(root: &Path, files: &[(&str, Vec)]) -> (AppState, DocumentId) { @@ -29,7 +29,11 @@ fn folder_of(root: &Path, files: &[(&str, Vec)]) -> (AppState, DocumentId) { } /// The names of the rows directly under `folder`, sorted. -pub(super) fn names_under(state: &AppState, doc: DocumentId, folder: RpfNodeId) -> Vec { +pub(in crate::state) fn names_under( + state: &AppState, + doc: DocumentId, + folder: RpfNodeId, +) -> Vec { let Some(DocPayload::Rpf(rpf)) = state.document(doc).map(|d| &d.payload) else { return Vec::new(); }; @@ -44,8 +48,8 @@ pub(super) fn names_under(state: &AppState, doc: DocumentId, folder: RpfNodeId) } /// Take away what a copy wrote out for Explorer, once a test has looked at it. -pub(super) fn forget_offered(offered: &[PathBuf]) { - let scratch = (super::config_root()) +pub(in crate::state) fn forget_offered(offered: &[PathBuf]) { + let scratch = (crate::state::config_root()) .expect("the run's own folder, where a test's copy stages") .join("openrage-clipboard"); for path in offered.iter().filter(|p| p.starts_with(&scratch)) { diff --git a/src/state/copy_cut_and_paste/records.rs b/src/state/tests/copy_cut_and_paste/records.rs similarity index 100% rename from src/state/copy_cut_and_paste/records.rs rename to src/state/tests/copy_cut_and_paste/records.rs diff --git a/src/state/defragmenting_an_archive.rs b/src/state/tests/defragmenting_an_archive.rs similarity index 94% rename from src/state/defragmenting_an_archive.rs rename to src/state/tests/defragmenting_an_archive.rs index 01360811d..be8485d48 100644 --- a/src/state/defragmenting_an_archive.rs +++ b/src/state/tests/defragmenting_an_archive.rs @@ -6,9 +6,9 @@ use std::time::{Duration, Instant}; use or_io::container::rpf::{RpfArchive, RpfBuilder, RpfEntry}; -use super::document::{DocumentId, RpfNodeId}; -use super::prefs::EditMode; -use super::{AppState, DocPayload, PendingRetailEdit, RetailEditDecision}; +use crate::state::document::{DocumentId, RpfNodeId}; +use crate::state::prefs::EditMode; +use crate::state::{AppState, DocPayload, PendingRetailEdit, RetailEditDecision}; /// Every file's decoded bytes, by path. fn contents(bytes: &[u8]) -> Vec<(String, Vec)> { @@ -23,7 +23,7 @@ fn contents(bytes: &[u8]) -> Vec<(String, Vec)> { } /// An archive whose largest file was moved to the end, leaving a hole where it was. -pub(super) fn fragmented() -> Vec { +pub(in crate::state) fn fragmented() -> Vec { let mut bytes = RpfBuilder::default() .insert_with("a.bin", vec![0xA5; 8192], false) .expect("add") @@ -79,7 +79,7 @@ fn with_archive(state: &mut AppState, path: &Path) -> (DocumentId, RpfNodeId) { (doc_id, node) } -pub(super) fn settle(state: &mut AppState) { +pub(in crate::state) fn settle(state: &mut AppState) { let deadline = Instant::now() + Duration::from_secs(60); while state.defrag.is_running() { state.poll_defrag(); @@ -195,7 +195,8 @@ fn opened( path: &Path, ) -> Vec { let archive = - super::rpf_archive_open::open_archive_from_disk(path, state.keys.provider()).expect("open"); + crate::state::rpf_archive_open::open_archive_from_disk(path, state.keys.provider()) + .expect("open"); let Some(DocPayload::Rpf(rpf)) = state.document_mut(doc_id).map(|d| &mut d.payload) else { panic!("an archive tree"); }; @@ -203,12 +204,12 @@ fn opened( .session .register_archive(archive.clone(), Some(path.to_path_buf())) .expect("an id for the archive"); - if let Some(super::RpfNodeBacking::Archive { archive_id, .. }) = + if let Some(crate::state::RpfNodeBacking::Archive { archive_id, .. }) = rpf.session.node_mut(node).map(|n| &mut n.backing) { *archive_id = Some(id); } - let listing = super::expander::list_archive(archive).expect("list"); + let listing = crate::state::expander::list_archive(archive).expect("list"); rpf.session .populate_archive_children(node, id, &listing) .expect("populate"); @@ -219,7 +220,7 @@ fn opened( .collect() } -fn rpf(state: &mut AppState, doc_id: DocumentId) -> &mut super::RpfDocument { +fn rpf(state: &mut AppState, doc_id: DocumentId) -> &mut crate::state::RpfDocument { match state.document_mut(doc_id).map(|d| &mut d.payload) { Some(DocPayload::Rpf(rpf)) => rpf, _ => panic!("an archive tree"), @@ -250,7 +251,7 @@ fn staged() -> ( /// ⚠ The rebuild reads the file, so an unsaved edit or an open tab inside refuses, at the start and at the answer. #[test] fn defragmenting_refuses_unsaved_edits_and_open_tabs() { - type Spoil = fn(&mut super::RpfDocument, DocumentId, RpfNodeId); + type Spoil = fn(&mut crate::state::RpfDocument, DocumentId, RpfNodeId); let spoilers: [(&str, Spoil); 2] = [ ("an unsaved edit", |rpf, _, file| { rpf.session diff --git a/src/state/destructive_file_operations_ask.rs b/src/state/tests/destructive_file_operations_ask.rs similarity index 96% rename from src/state/destructive_file_operations_ask.rs rename to src/state/tests/destructive_file_operations_ask.rs index 9853748b0..4e7dde2e5 100644 --- a/src/state/destructive_file_operations_ask.rs +++ b/src/state/tests/destructive_file_operations_ask.rs @@ -9,13 +9,13 @@ use std::time::{Duration, Instant}; use or_io::container::rpf::BodyForm; -use super::delete_prompt::DeleteFrom; -use super::document::{Document, DocumentId, RpfNodeId}; -use super::extract_job::{ExtractStart, TypeFilter}; use super::nothing_extracts_into_an_install::files_under; -use super::rpf_session::{RpfDocument, RpfEditSession}; -use super::{AppState, DocPayload}; use crate::platform::recycle_bin; +use crate::state::delete_prompt::DeleteFrom; +use crate::state::document::{Document, DocumentId, RpfNodeId}; +use crate::state::extract_job::{ExtractStart, TypeFilter}; +use crate::state::rpf_session::{RpfDocument, RpfEditSession}; +use crate::state::{AppState, DocPayload}; /// A folder holding `files`, opened as Open Folder opens one. fn loose_folder(files: &[(&str, &[u8])]) -> (tempfile::TempDir, PathBuf, AppState, DocumentId) { @@ -96,7 +96,7 @@ fn child(state: &AppState, doc: DocumentId, folder: RpfNodeId, name: &str) -> Op } /// The row at `path`, each folder on the way scanned as the tree scans it. -pub(super) fn node_at(state: &mut AppState, doc: DocumentId, path: &str) -> RpfNodeId { +pub(in crate::state) fn node_at(state: &mut AppState, doc: DocumentId, path: &str) -> RpfNodeId { let mut node = session(state, doc).root_id(); for name in path.split('/') { state.request_expand(doc, node); diff --git a/src/state/dropped_files.rs b/src/state/tests/dropped_files.rs similarity index 87% rename from src/state/dropped_files.rs rename to src/state/tests/dropped_files.rs index 3ba847b18..b744bec8f 100644 --- a/src/state/dropped_files.rs +++ b/src/state/tests/dropped_files.rs @@ -3,7 +3,7 @@ use std::path::{Path, PathBuf}; /// Write each of `names` under `dir/drop`; the words stand for the file, so equal words are equal bytes ([`or_source::sample::build_game_file`]). -pub(super) fn drop_files(dir: &Path, names: &[(&str, &[u8])]) -> Vec { +pub(in crate::state) fn drop_files(dir: &Path, names: &[(&str, &[u8])]) -> Vec { names .iter() .map(|(name, body)| { diff --git a/src/state/dropping_and_importing_folders.rs b/src/state/tests/dropping_and_importing_folders.rs similarity index 98% rename from src/state/dropping_and_importing_folders.rs rename to src/state/tests/dropping_and_importing_folders.rs index e2722edd1..af3dd886f 100644 --- a/src/state/dropping_and_importing_folders.rs +++ b/src/state/tests/dropping_and_importing_folders.rs @@ -8,7 +8,7 @@ use or_source::game_import::Verdict; use super::importing_game_files_from_the_app::{imported, project, sources_of, write, ytd}; -use super::jobs::JobKind; +use crate::state::jobs::JobKind; #[test] fn an_import_cancelled_the_moment_it_starts_loses_no_file_whatever_it_had_reached() { diff --git a/src/state/editing_a_clip.rs b/src/state/tests/editing_a_clip.rs similarity index 99% rename from src/state/editing_a_clip.rs rename to src/state/tests/editing_a_clip.rs index 3b373b099..b85134d28 100644 --- a/src/state/editing_a_clip.rs +++ b/src/state/tests/editing_a_clip.rs @@ -1,4 +1,4 @@ -use super::*; +use crate::state::*; /// The active document's history. fn history(state: &AppState) -> &EditHistory { diff --git a/src/state/enhanced_controls_say_so.rs b/src/state/tests/enhanced_controls_say_so.rs similarity index 97% rename from src/state/enhanced_controls_say_so.rs rename to src/state/tests/enhanced_controls_say_so.rs index eed53e7f5..98bc01780 100644 --- a/src/state/enhanced_controls_say_so.rs +++ b/src/state/tests/enhanced_controls_say_so.rs @@ -6,29 +6,29 @@ use std::path::PathBuf; use or_io::decl::{Gen8, Gen9}; -use super::textures::{textures_in, TextureListing}; use super::the_panels_around_the_viewer_take_both_targets::{a_fragment, a_list, Fixture}; -use super::{AppState, DocPayload, Prefs}; +use crate::state::textures::{textures_in, TextureListing}; use crate::state::Workspace; +use crate::state::{AppState, DocPayload, Prefs}; use crate::ui::panels::texture_preview::ENHANCED_TEXTURES; use crate::ui::panels::timeline::NOT_SIMULATED; /// What a probe of one control found: whether it is greyed, and every text a hover painted that a /// frame with the pointer away did not, so a line painted all the time is not a hover text. -pub(super) struct Control { - pub(super) disabled: bool, +pub(in crate::state) struct Control { + pub(in crate::state) disabled: bool, said: BTreeSet, } impl Control { - pub(super) fn says(&self, text: &str) -> bool { + pub(in crate::state) fn says(&self, text: &str) -> bool { self.said.contains(text) } } /// One frame of `draw` at `time`: the centre and greyed state of the control labelled `label`, and /// how many times each text was painted. -pub(super) fn frame( +pub(in crate::state) fn frame( ctx: &egui::Context, draw: fn(&mut egui::Ui, &mut AppState), state: &mut AppState, @@ -73,7 +73,7 @@ pub(super) fn frame( } /// The control labelled `label` in what `draw` paints, found with the pointer away, then hovered for long enough for a tooltip. -pub(super) fn control( +pub(in crate::state) fn control( draw: fn(&mut egui::Ui, &mut AppState), state: &mut AppState, label: &str, @@ -305,7 +305,7 @@ fn the_texture_preview_greys_apply_import_embed_and_unembed_over_an_enhanced_tex #[test] fn the_constant_that_says_a_target_is_simulated_is_what_tick_sim_does_with_its_list() { - use super::particle_target::ParticleTarget; + use crate::state::particle_target::ParticleTarget; let mut legacy = opened_as("probe.ypt", Gen8::particles(a_list::())); legacy.tick_sim(); assert_eq!( diff --git a/src/state/every_add_lands_where_the_tree_shows_it.rs b/src/state/tests/every_add_lands_where_the_tree_shows_it.rs similarity index 75% rename from src/state/every_add_lands_where_the_tree_shows_it.rs rename to src/state/tests/every_add_lands_where_the_tree_shows_it.rs index 0e4417e72..aa967f689 100644 --- a/src/state/every_add_lands_where_the_tree_shows_it.rs +++ b/src/state/tests/every_add_lands_where_the_tree_shows_it.rs @@ -3,10 +3,10 @@ use std::path::Path; -use super::{AppState, DocumentId, DocumentKind}; +use crate::state::{AppState, DocumentId, DocumentKind}; /// `folder` opened with Open Folder, and its document. -pub(super) fn opened(state: &mut AppState, folder: &Path) -> DocumentId { +pub(in crate::state) fn opened(state: &mut AppState, folder: &Path) -> DocumentId { state.open_folder(folder.to_path_buf()); state .documents diff --git a/src/state/every_edit_undoes.rs b/src/state/tests/every_edit_undoes.rs similarity index 94% rename from src/state/every_edit_undoes.rs rename to src/state/tests/every_edit_undoes.rs index aa548abcc..6822c3c3c 100644 --- a/src/state/every_edit_undoes.rs +++ b/src/state/tests/every_edit_undoes.rs @@ -7,10 +7,10 @@ use or_io::container::resource::Rsc7; use or_io::desc::ScalarValue; use super::nested_archives_survive_a_save::save; -use super::{AppState, DocPayload, Document, DocumentId, EditHistory, ResourceImage}; +use crate::state::{AppState, DocPayload, Document, DocumentId, EditHistory, ResourceImage}; /// A Legacy drawable whose resource image is all zeros, at `path`. -pub(super) fn drawable(state: &mut AppState, path: &str) -> DocumentId { +pub(in crate::state) fn drawable(state: &mut AppState, path: &str) -> DocumentId { let format = or_io::gta5::formats::format("ydr").expect(".ydr is declared"); let version = or_io::container::resource::ResourceType::Ydr .read_versions() @@ -33,13 +33,13 @@ pub(super) fn drawable(state: &mut AppState, path: &str) -> DocumentId { } /// The `n`th field of `doc`'s described grid that takes a float, with its label. -pub(super) fn float_field( +pub(in crate::state) fn float_field( state: &AppState, doc: DocumentId, n: usize, ) -> (String, or_editor::Edit) { let doc = state.document(doc).expect("open"); - let (pack, root) = super::described_root(doc).expect("a drawable is described"); + let (pack, root) = crate::state::described_root(doc).expect("a drawable is described"); let image = doc.resource.as_ref().expect("an image"); let summary = or_editor::Summary::of(&pack, &root, image.view(), 0).expect("a summary"); summary diff --git a/src/state/every_question_fits_a_narrow_window.rs b/src/state/tests/every_question_fits_a_narrow_window.rs similarity index 93% rename from src/state/every_question_fits_a_narrow_window.rs rename to src/state/tests/every_question_fits_a_narrow_window.rs index 629d7a5e9..ff473d973 100644 --- a/src/state/every_question_fits_a_narrow_window.rs +++ b/src/state/tests/every_question_fits_a_narrow_window.rs @@ -9,13 +9,13 @@ use or_interchange::Scene; use or_io::gta5::File as _; use super::converting_from_the_app::{question_frame_on, question_labels}; -use super::delete_prompt::{DeleteFrom, PendingDelete}; use super::every_write_asks_the_jobs_reading_it::exported; -use super::extract_job::ExtractClash; -use super::gltf::{Asked, Import, ImportChoice}; -use super::jobs::JobKind; -use super::payload_handlers::handler_for_payload; -use super::{AppState, DocPayload, Prefs}; +use crate::state::delete_prompt::{DeleteFrom, PendingDelete}; +use crate::state::extract_job::ExtractClash; +use crate::state::gltf::{Asked, Import, ImportChoice}; +use crate::state::jobs::JobKind; +use crate::state::payload_handlers::handler_for_payload; +use crate::state::{AppState, DocPayload, Prefs}; fn told(state: &AppState, what: &str) -> bool { state.toasts.iter().any(|t| t.message.contains(what)) @@ -101,7 +101,7 @@ fn questions() -> Vec<(&'static str, AppState)> { nodes: vec![crate::state::RpfNodeId(1)], dest: PathBuf::from("C:/somewhere/out"), form: or_io::container::rpf::BodyForm::Decoded, - filter: super::extract_job::TypeFilter::All, + filter: crate::state::extract_job::TypeFilter::All, fixes: false, clashes: 2, planned: 5, @@ -172,8 +172,8 @@ fn a_conversion_written_while_another_job_holds_the_slot_names_it_and_keeps_the_ .to_bytes() .expect("a Legacy .ytd saves"); let made = or_cli::retarget_file("paint.ytd", &bytes, &Default::default()); - state.convert.done = Some(super::convert::Converted { - files: vec![super::convert::ConvertedFile { + state.convert.done = Some(crate::state::convert::Converted { + files: vec![crate::state::convert::ConvertedFile { name: "paint.ytd".into(), outcome: Ok(made.expect("it converts")), }], diff --git a/src/state/every_view_follows_every_edit.rs b/src/state/tests/every_view_follows_every_edit.rs similarity index 99% rename from src/state/every_view_follows_every_edit.rs rename to src/state/tests/every_view_follows_every_edit.rs index ff0ac9425..7285cdb3e 100644 --- a/src/state/every_view_follows_every_edit.rs +++ b/src/state/tests/every_view_follows_every_edit.rs @@ -9,14 +9,14 @@ use or_test_support::{skip_corpus, Corpus}; use super::an_edit_stays_where_it_was_made::{ drawable_with_a_material, edit_a_material, grid_row, open, }; -use super::textures::{textures_in, TextureListing}; -use super::{ - AppState, DocPayload, Document, DocumentId, MeshSource, SkeletonSource, TextureSource, -}; use crate::render::gpu_budget::{GpuTextureKey, GpuTextures}; use crate::render::meshes::build_meshes_for_active_document; use crate::render::thumbnails::ThumbKey; use crate::render::viewport::{bound_texture, MeshCacheKey}; +use crate::state::textures::{textures_in, TextureListing}; +use crate::state::{ + AppState, DocPayload, Document, DocumentId, MeshSource, SkeletonSource, TextureSource, +}; use crate::state::{SelectionKey, Workspace}; /// A staged Legacy drawable or fragment, open and active, whose meshes bind a texture it embeds beside another. diff --git a/src/state/every_viewer_path_takes_both_targets.rs b/src/state/tests/every_viewer_path_takes_both_targets.rs similarity index 98% rename from src/state/every_viewer_path_takes_both_targets.rs rename to src/state/tests/every_viewer_path_takes_both_targets.rs index b78b9dde6..99fde6bcd 100644 --- a/src/state/every_viewer_path_takes_both_targets.rs +++ b/src/state/tests/every_viewer_path_takes_both_targets.rs @@ -12,16 +12,16 @@ use or_io::gta5::{ }; use or_test_support::{skip_corpus, Corpus, TARGET_GEN8, TARGET_GEN9}; -use super::models::{models_in, ModelListing}; -use super::preview_scene::{ - mesh_sources_in, skeleton_data_from, skeleton_sources_in, SkeletonSource, -}; -use super::texture_resolution::{report, resolve, ResolutionRule}; -use super::textures::{textures_in, TextureListing}; -use super::{AppState, DocPayload, Document, DocumentId, SelectionKey}; use crate::render::lines::build_lines_for_active_document; use crate::render::meshes::build_meshes_for_active_document; use crate::render::viewport::compute_active_doc_bounds; +use crate::state::models::{models_in, ModelListing}; +use crate::state::preview_scene::{ + mesh_sources_in, skeleton_data_from, skeleton_sources_in, SkeletonSource, +}; +use crate::state::texture_resolution::{report, resolve, ResolutionRule}; +use crate::state::textures::{textures_in, TextureListing}; +use crate::state::{AppState, DocPayload, Document, DocumentId, SelectionKey}; /// The code a test dictionary keys its one entry by. const ENTRY: u32 = 0x5EED_0001; diff --git a/src/state/every_write_asks_the_jobs_reading_it.rs b/src/state/tests/every_write_asks_the_jobs_reading_it.rs similarity index 89% rename from src/state/every_write_asks_the_jobs_reading_it.rs rename to src/state/tests/every_write_asks_the_jobs_reading_it.rs index 3f53c91b2..2f6159bd5 100644 --- a/src/state/every_write_asks_the_jobs_reading_it.rs +++ b/src/state/tests/every_write_asks_the_jobs_reading_it.rs @@ -12,18 +12,18 @@ use std::sync::Arc; use or_interchange::Scene; use or_io::Generation; -use super::convert::{Converted, ConvertedFile}; use super::converting_from_the_app::written_by_the_job; -use super::gltf::{Asked, Export, ExportChoice}; -use super::jobs::JobKind; use super::nested_archives_survive_a_save::errors; use super::no_save_replaces_a_file_a_job_reads::{ended, named, running}; -use super::AppState; +use crate::state::convert::{Converted, ConvertedFile}; +use crate::state::gltf::{Asked, Export, ExportChoice}; +use crate::state::jobs::JobKind; +use crate::state::AppState; -pub(super) const BUILD: &str = "DLC pack mypack"; +pub(in crate::state) const BUILD: &str = "DLC pack mypack"; /// A DLC pack `mypack` being built in `state` from a folder of `scratch`: the folder inside it that the build reads. -pub(super) fn pack_built_from(state: &mut AppState, scratch: &Path) -> PathBuf { +pub(in crate::state) fn pack_built_from(state: &mut AppState, scratch: &Path) -> PathBuf { let source = scratch.join("mypack_src"); let props = source.join("x64").join("levels").join("gta5").join("props"); std::fs::create_dir_all(&props).expect("the folders"); @@ -43,14 +43,14 @@ pub(super) fn pack_built_from(state: &mut AppState, scratch: &Path) -> PathBuf { } /// A DLC pack `mypack` being built from a folder: the state, and the folder inside it that the build reads. -pub(super) fn building(scratch: &Path) -> (AppState, PathBuf) { +pub(in crate::state) fn building(scratch: &Path) -> (AppState, PathBuf) { let mut state = AppState::new(); let props = pack_built_from(&mut state, scratch); (state, props) } /// What a conversion made of files called `names`, as its worker hands it over. -pub(super) fn made(names: &[&str]) -> Converted { +pub(in crate::state) fn made(names: &[&str]) -> Converted { let file = |name: &&str| ConvertedFile { name: name.to_string(), outcome: Ok(or_cli::Retargeted { @@ -68,7 +68,7 @@ pub(super) fn made(names: &[&str]) -> Converted { } /// A glTF export of `scene`, worked out and waiting on where it goes. -pub(super) fn exported(scene: Scene) -> Asked { +pub(in crate::state) fn exported(scene: Scene) -> Asked { Asked::Export(Export { name: "prop.ydr".into(), bytes: Arc::new(Vec::new()), @@ -85,7 +85,7 @@ pub(super) fn exported(scene: Scene) -> Asked { } /// Whether `files` are all there, as `files` lists them. -pub(super) fn all_there(files: &[PathBuf]) -> bool { +pub(in crate::state) fn all_there(files: &[PathBuf]) -> bool { files.iter().all(|file| file.is_file()) } diff --git a/src/state/every_write_into_a_folder_a_job_reads_is_refused.rs b/src/state/tests/every_write_into_a_folder_a_job_reads_is_refused.rs similarity index 97% rename from src/state/every_write_into_a_folder_a_job_reads_is_refused.rs rename to src/state/tests/every_write_into_a_folder_a_job_reads_is_refused.rs index c7668b2a2..13c9665bb 100644 --- a/src/state/every_write_into_a_folder_a_job_reads_is_refused.rs +++ b/src/state/tests/every_write_into_a_folder_a_job_reads_is_refused.rs @@ -9,14 +9,14 @@ use or_io::container::rpf::BodyForm; use super::a_moved_or_deleted_archive_row_leaves_nothing_behind::folder_of; -use super::compare::Ended; use super::converting_from_the_app::written_by_the_job; use super::every_write_asks_the_jobs_reading_it::{all_there, building, made, BUILD}; -use super::extract_job::TypeFilter; -use super::jobs::JobKind; use super::nested_archives_survive_a_save::errors; use super::no_save_replaces_a_file_a_job_reads::{ended, named, shipped}; use super::opening_a_ydd::node_at; +use crate::state::compare::Ended; +use crate::state::extract_job::TypeFilter; +use crate::state::jobs::JobKind; /// ⚠ A job reading one file of a folder holds back the files an extraction writes beside it. #[test] diff --git a/src/state/fix_all_safe_and_the_optimiser_in_the_app.rs b/src/state/tests/fix_all_safe_and_the_optimiser_in_the_app.rs similarity index 98% rename from src/state/fix_all_safe_and_the_optimiser_in_the_app.rs rename to src/state/tests/fix_all_safe_and_the_optimiser_in_the_app.rs index 3c534d26a..f580d1f6d 100644 --- a/src/state/fix_all_safe_and_the_optimiser_in_the_app.rs +++ b/src/state/tests/fix_all_safe_and_the_optimiser_in_the_app.rs @@ -15,12 +15,12 @@ use or_source::game_import::{decompile, Facts}; use or_wardrobe::{Component, Garment, Ped, Slot, Variation, Wardrobe}; use super::the_wardrobe_workspace::{opened, until}; -use super::workbench::{Cut, Draft, Question}; -use super::AppState; +use crate::state::workbench::{Cut, Draft, Question}; +use crate::state::AppState; use crate::ui::commands::{self, Action}; /// A `.ytd` of one texture of `width` by `height` that stores one mip. -pub(super) fn ytd(name: &str, width: u32, height: u32) -> Vec { +pub(in crate::state) fn ytd(name: &str, width: u32, height: u32) -> Vec { let mut image = RgbaImage::new(width, height); for y in 0..height { for x in 0..width { diff --git a/src/state/gltf_in_and_out_from_the_app.rs b/src/state/tests/gltf_in_and_out_from_the_app.rs similarity index 98% rename from src/state/gltf_in_and_out_from_the_app.rs rename to src/state/tests/gltf_in_and_out_from_the_app.rs index 17de13b17..ffee65e50 100644 --- a/src/state/gltf_in_and_out_from_the_app.rs +++ b/src/state/tests/gltf_in_and_out_from_the_app.rs @@ -10,12 +10,12 @@ use or_interchange::gltf::{self, Container}; use or_interchange::{report_lines, ExtractOptions, ImportOptions, LodSelection, Scene}; use or_test_support::{skip_corpus, Corpus, TARGET_GEN8, TARGET_GEN9}; -use super::gltf::{Asked, Export, ExportChoice}; use super::the_files_view_in_the_centre::{leaf_of, listed}; -use super::{AppState, DocumentId, EditMode, Game, Prefs, RpfNodeId}; use crate::render::meshes::build_meshes_for_active_document; use crate::render::viewport::MeshCacheKey; +use crate::state::gltf::{Asked, Export, ExportChoice}; use crate::state::panel_ids as ids; +use crate::state::{AppState, DocumentId, EditMode, Game, Prefs, RpfNodeId}; const MANIFEST: &str = env!("CARGO_MANIFEST_DIR"); const DEADLINE: Duration = Duration::from_secs(180); @@ -243,11 +243,12 @@ fn browsing(input: &Path) -> (AppState, egui::Context, DocumentId) { } fn row(state: &AppState, folder: DocumentId, name: &str) -> RpfNodeId { - let Some(super::DocPayload::Rpf(rpf)) = state.document(folder).map(|d| &d.payload) else { + let Some(crate::state::DocPayload::Rpf(rpf)) = state.document(folder).map(|d| &d.payload) + else { panic!("the folder is open"); }; - match super::navigation::resolve_path(&rpf.session, name) { - super::navigation::Resolved::Found(id) => id, + match crate::state::navigation::resolve_path(&rpf.session, name) { + crate::state::navigation::Resolved::Found(id) => id, other => panic!("{name}: {other:?}"), } } @@ -445,7 +446,8 @@ fn a_ydr_exports_and_imports_back_from_its_menus_and_saves_what_the_cli_writes() ); assert_eq!(state.undo().as_deref(), Some("Replace from edited.glb")); let payload = &state.document(doc).expect("open").payload; - let writer = super::payload_handlers::handler_for_payload(payload).expect("a writer"); + let writer = + crate::state::payload_handlers::handler_for_payload(payload).expect("a writer"); let undone = writer.save(payload).expect("it saves"); let as_opened = or_io::open(&model).and_then(|asset| asset.to_bytes()); assert!( diff --git a/src/state/going_to_a_file.rs b/src/state/tests/going_to_a_file.rs similarity index 98% rename from src/state/going_to_a_file.rs rename to src/state/tests/going_to_a_file.rs index e2e55e4b6..1a6007a11 100644 --- a/src/state/going_to_a_file.rs +++ b/src/state/tests/going_to_a_file.rs @@ -11,10 +11,10 @@ use std::time::{Duration, Instant}; use egui::accesskit::Role; use winit::keyboard::{Key, KeyCode, PhysicalKey}; -use super::document::{DocumentId, RpfNodeId}; -use super::navigation::{resolve_path, Resolved}; use super::nested_archives_survive_a_save::archive; -use super::{AppState, DocPayload, DocumentKind, Game, Prefs}; +use crate::state::document::{DocumentId, RpfNodeId}; +use crate::state::navigation::{resolve_path, Resolved}; +use crate::state::{AppState, DocPayload, DocumentKind, Game, Prefs}; const NONE: egui::Modifiers = egui::Modifiers::NONE; diff --git a/src/state/gta6_textures_resolve_and_save.rs b/src/state/tests/gta6_textures_resolve_and_save.rs similarity index 91% rename from src/state/gta6_textures_resolve_and_save.rs rename to src/state/tests/gta6_textures_resolve_and_save.rs index a57ec1c27..2a11cd156 100644 --- a/src/state/gta6_textures_resolve_and_save.rs +++ b/src/state/tests/gta6_textures_resolve_and_save.rs @@ -4,8 +4,8 @@ use or_io::codec::texture::{decode_level, RgbaImage}; use super::opening_a_ttpf::{open, pack, save_as, written, SIDE}; -use super::textures::TextureSource as Source; -use super::{AppState, DocPayload}; +use crate::state::textures::TextureSource as Source; +use crate::state::{AppState, DocPayload}; fn blue() -> RgbaImage { RgbaImage { @@ -91,12 +91,12 @@ fn a_pack_saved_over_another_tab_s_file_leaves_that_tab_s_edits_to_ask_first() { fn a_pack_save_stopped_before_its_rename_leaves_the_file_as_it_was() { let dir = tempfile::tempdir().expect("a scratch directory"); let source = written(dir.path(), &pack(0xF800)); - let ttpf = super::ttpf_document::TtpfDocument::open(&source).expect("opens"); + let ttpf = crate::state::ttpf_document::TtpfDocument::open(&source).expect("opens"); let cancel = or_job::Cancel::new(); cancel.set(); let stopped = - super::ttpf_document::saved(&ttpf, &source, &cancel, crate::state::DocumentId(0), 0); - assert!(matches!(stopped, super::SaveResult::Stopped)); + crate::state::ttpf_document::saved(&ttpf, &source, &cancel, crate::state::DocumentId(0), 0); + assert!(matches!(stopped, crate::state::SaveResult::Stopped)); assert!(std::fs::read(&source).expect("read") == pack(0xF800)); assert!(!dir.path().join("textures.ttpf.tmp").exists()); } diff --git a/src/state/importing_game_files_from_the_app.rs b/src/state/tests/importing_game_files_from_the_app.rs similarity index 92% rename from src/state/importing_game_files_from_the_app.rs rename to src/state/tests/importing_game_files_from_the_app.rs index 1e51e256c..424d84ebb 100644 --- a/src/state/importing_game_files_from_the_app.rs +++ b/src/state/tests/importing_game_files_from_the_app.rs @@ -20,17 +20,17 @@ use or_title::Game; use super::every_add_lands_where_the_tree_shows_it::opened as open_folder; use super::nested_archives_survive_a_save::archive; use super::opening_a_ydd::{finish_load, node_at}; -use super::workbench::{AssetRow, AssetState}; -use super::{AppState, Prefs}; +use crate::state::workbench::{AssetRow, AssetState}; use crate::state::Workspace; +use crate::state::{AppState, Prefs}; -pub(super) fn write(path: &Path, body: &[u8]) { +pub(in crate::state) fn write(path: &Path, body: &[u8]) { std::fs::create_dir_all(path.parent().unwrap()).unwrap(); std::fs::write(path, body).unwrap(); } /// A Legacy texture dictionary of one block-compressed texture, whose pixels `shade` decides. -pub(super) fn ytd(name: &str, shade: u8) -> Vec { +pub(in crate::state) fn ytd(name: &str, shade: u8) -> Vec { let format = GrcTextureFormat::DXT1; let texture = GrcTexture { name: name.into(), @@ -53,7 +53,7 @@ pub(super) fn ytd(name: &str, shade: u8) -> Vec { } /// An empty project in `dir/police_pack`, opened in a state, and the folder it is in. -pub(super) fn project(dir: &Path) -> (AppState, PathBuf) { +pub(in crate::state) fn project(dir: &Path) -> (AppState, PathBuf) { let folder = dir.join("police_pack"); std::fs::create_dir_all(&folder).unwrap(); let mut container = Container::default(); @@ -70,7 +70,7 @@ pub(super) fn project(dir: &Path) -> (AppState, PathBuf) { (state, folder) } -pub(super) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) -> bool) { +pub(in crate::state) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) -> bool) { let deadline = Instant::now() + Duration::from_secs(30); loop { state.poll_workbench(); @@ -83,13 +83,13 @@ pub(super) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) - } /// Polls until the import that was started has ended and left its report. -pub(super) fn imported(state: &mut AppState) { +pub(in crate::state) fn imported(state: &mut AppState) { until(state, "the import", |s| { !s.workbench.imports.is_running() && s.workbench.imports.report().is_some() }); } -pub(super) fn row<'a>(state: &'a AppState, name: &str) -> &'a AssetRow { +pub(in crate::state) fn row<'a>(state: &'a AppState, name: &str) -> &'a AssetRow { state .workbench .rows() @@ -98,7 +98,7 @@ pub(super) fn row<'a>(state: &'a AppState, name: &str) -> &'a AssetRow { .unwrap_or_else(|| panic!("no asset named {name}: {:?}", state.workbench.rows())) } -pub(super) fn sources_of(folder: &Path) -> Vec { +pub(in crate::state) fn sources_of(folder: &Path) -> Vec { let mut names: Vec = std::fs::read_dir(folder.join("sources")) .into_iter() .flatten() @@ -109,7 +109,7 @@ pub(super) fn sources_of(folder: &Path) -> Vec { names } -pub(super) fn manifest_of(folder: &Path) -> AssetManifest { +pub(in crate::state) fn manifest_of(folder: &Path) -> AssetManifest { let text = std::fs::read_to_string(folder.join("asset.json")).expect("an asset.json"); AssetManifest::parse(&text).expect("a manifest") } @@ -154,7 +154,7 @@ fn an_archive_entry_is_imported_with_its_archive_path_and_the_archive_is_not_tou } /// A project, and an install mounted as Legacy at `dir/GTAV` that holds `x64/pack.rpf` of `a.ytd`. -pub(super) fn project_and_install(dir: &Path) -> (AppState, PathBuf, PathBuf) { +pub(in crate::state) fn project_and_install(dir: &Path) -> (AppState, PathBuf, PathBuf) { let (mut state, folder) = project(dir); let install = dir.join("GTAV"); write( diff --git a/src/state/maps_and_a_budget_in_the_app.rs b/src/state/tests/maps_and_a_budget_in_the_app.rs similarity index 99% rename from src/state/maps_and_a_budget_in_the_app.rs rename to src/state/tests/maps_and_a_budget_in_the_app.rs index 29e12a58a..d59adefcb 100644 --- a/src/state/maps_and_a_budget_in_the_app.rs +++ b/src/state/tests/maps_and_a_budget_in_the_app.rs @@ -17,8 +17,8 @@ use or_wardrobe::slots::MapSlot; use or_wardrobe::{Component, Garment, Ped, Slot, Variation, Wardrobe}; use super::the_wardrobe_workspace::{opened, until}; -use super::workbench::Question; -use super::AppState; +use crate::state::workbench::Question; +use crate::state::AppState; use crate::ui::commands::{self, Action}; /// A `.ytd` of one texture of `side` by `side`, DXT1, one mip, with a weave in it. diff --git a/src/state/tests.rs b/src/state/tests/mod.rs similarity index 57% rename from src/state/tests.rs rename to src/state/tests/mod.rs index e256631db..2ef246d22 100644 --- a/src/state/tests.rs +++ b/src/state/tests/mod.rs @@ -1,4 +1,157 @@ -use super::*; +pub(crate) mod a_b_compares_the_pack_with_its_previous_kept_version; +pub(crate) mod a_bones_numbers_can_be_edited; +pub(crate) mod a_change_on_disk_keeps_the_undo_steps_beside_it; +pub(crate) mod a_drag_carries_every_selected_row; +pub(crate) mod a_drag_copies_and_a_change_of_nothing_does_nothing; +pub(crate) mod a_field_that_shapes_the_data_is_not_edited_in_place; +pub(crate) mod a_garments_cloth_is_linked_and_its_shop_ids_are_kept; +pub(crate) mod a_gta_vi_archive_s_scan_is_kept; +pub(crate) mod a_model_is_drawn_with_its_own_textures; +pub(crate) mod a_moved_or_deleted_archive_row_leaves_nothing_behind; +pub(crate) mod a_new_project; +pub(crate) mod a_pick_in_the_preview_opens_its_document_at_its_row; +pub(crate) mod a_pinned_inspector_shows_its_own_document; +pub(crate) mod a_plugin_asks_before_it_runs; +pub(crate) mod a_project_holds_only_sources; +pub(crate) mod a_recook_reloads_what_is_open; +pub(crate) mod a_rename_on_disk_waits_for_the_extraction_reading_it; +pub(crate) mod a_right_click_or_a_drag_selects_its_row; +pub(crate) mod a_save_names_its_destination; +pub(crate) mod a_self_check_keeps_to_itself; +pub(crate) mod a_skeleton_is_seen_without_an_animation; +pub(crate) mod a_wardrobe_edit_is_recoverable; +pub(crate) mod adding_a_format; +pub(crate) mod adding_particle_files_is_an_import; +pub(crate) mod adding_weapons_is_an_import; +pub(crate) mod an_alt_click_in_the_viewport_picks_a_model; +pub(crate) mod an_awc_animation_is_written_back; +pub(crate) mod an_awc_stream_opens_its_animation; +pub(crate) mod an_edit_of_the_wardrobe_is_a_step_of_undo; +pub(crate) mod an_edit_stays_where_it_was_made; +pub(crate) mod an_error_names_what_failed; +pub(crate) mod an_export_asks_before_it_alters_the_bytes; +pub(crate) mod an_extraction_holds_back_only_the_files_it_reads; +pub(crate) mod an_import_ends_with_a_toast_that_says_what_was_done_and_takes_it_back; +pub(crate) mod an_undo_finishes_or_says_why; +pub(crate) mod applying_a_preset; +pub(crate) mod authoring; +pub(crate) mod building_a_dlc_pack_from_the_app; +pub(crate) mod building_targets_from_the_app; +pub(crate) mod comparing_every_resource_and_archive; +pub(crate) mod comparing_two_files; +pub(crate) mod converting_from_the_app; +pub(crate) mod converting_in_a_modders_words; +pub(crate) mod converting_is_listed_and_asked_inside_its_panel; +pub(crate) mod copy_cut_and_paste; +pub(crate) mod defragmenting_an_archive; +pub(crate) mod destructive_file_operations_ask; +pub(crate) mod dropped_files; +pub(crate) mod dropping_and_importing_folders; +pub(crate) mod editing_a_clip; +pub(crate) mod enhanced_controls_say_so; +pub(crate) mod every_add_lands_where_the_tree_shows_it; +pub(crate) mod every_edit_undoes; +pub(crate) mod every_question_fits_a_narrow_window; +pub(crate) mod every_view_follows_every_edit; +pub(crate) mod every_viewer_path_takes_both_targets; +pub(crate) mod every_write_asks_the_jobs_reading_it; +pub(crate) mod every_write_into_a_folder_a_job_reads_is_refused; +pub(crate) mod fix_all_safe_and_the_optimiser_in_the_app; +pub(crate) mod gltf_in_and_out_from_the_app; +pub(crate) mod going_to_a_file; +pub(crate) mod gta6_textures_resolve_and_save; +pub(crate) mod importing_game_files_from_the_app; +pub(crate) mod maps_and_a_budget_in_the_app; +pub(crate) mod nested_archives_survive_a_save; +pub(crate) mod no_save_replaces_a_file_a_job_reads; +pub(crate) mod nothing_draws_over_what_it_belongs_to; +pub(crate) mod nothing_extracts_into_an_install; +pub(crate) mod one_place_for_background_jobs; +pub(crate) mod opening_a_dds; +pub(crate) mod opening_a_gta_vi_awc; +pub(crate) mod opening_a_gta_vi_body; +pub(crate) mod opening_a_nametable; +pub(crate) mod opening_a_rel; +pub(crate) mod opening_a_ttpf; +pub(crate) mod opening_a_ydd; +pub(crate) mod opening_an_awc; +pub(crate) mod opening_an_rpf9_archive; +pub(crate) mod opening_an_unknown_file; +pub(crate) mod opening_metadata_without_a_schema; +pub(crate) mod opening_world_dat; +pub(crate) mod opus_on_a_worker; +pub(crate) mod previewing_a_video; +pub(crate) mod reopening_a_built_pack_from_the_app; +pub(crate) mod reordering_mods_from_the_app; +pub(crate) mod replacing_geometry_from_the_app; +pub(crate) mod saving_twice_and_into_an_archive_not_yet_opened; +pub(crate) mod search_results_that_open; +pub(crate) mod settings_recents_and_small_editor_fixes; +pub(crate) mod shards; +pub(crate) mod sharing_a_project; +pub(crate) mod small_faults_in_the_default_views_menus_and_keys; +pub(crate) mod small_faults_in_the_editor_and_the_previews; +pub(crate) mod tabs_that_behave_like_an_editors; +pub(crate) mod test_scratch; +pub(crate) mod the_addon_ped_in_the_app; +pub(crate) mod the_animation_preview_draws_what_its_sources_hold; +pub(crate) mod the_animation_preview_follows_its_sources; +pub(crate) mod the_default_views_in_a_modders_words; +pub(crate) mod the_dressed_ped; +pub(crate) mod the_dressed_ped_shows_sets_the_first_person_view_and_the_floor_of_heels; +pub(crate) mod the_dressed_ped_wears_props; +pub(crate) mod the_edit_mode_is_visible_and_honest; +pub(crate) mod the_files_view_in_the_centre; +pub(crate) mod the_front_door; +pub(crate) mod the_front_door_opens_and_closes; +pub(crate) mod the_gate_in_front_of_every_write; +pub(crate) mod the_grid_and_undo_survive_an_edit_of_the_contents; +pub(crate) mod the_inspector_leads_with_a_summary; +pub(crate) mod the_lock_a_window_holds; +pub(crate) mod the_map_screen_holds_a_session; +pub(crate) mod the_map_screen_saves_with_the_project; +pub(crate) mod the_mesh_doctor_in_the_app; +pub(crate) mod the_panel_counts_the_apps_cpu_state; +pub(crate) mod the_panels_around_the_viewer_take_both_targets; +pub(crate) mod the_project_history; +pub(crate) mod the_project_history_across_imports_and_projects; +pub(crate) mod the_project_polish; +pub(crate) mod the_project_screens; +pub(crate) mod the_project_workspace; +pub(crate) mod the_rules_of_a_pack_are_set_and_its_problems_written_out_from_the_app; +pub(crate) mod the_shells_regions; +pub(crate) mod the_skeleton_files_own_model_can_be_hidden; +pub(crate) mod the_two_paths_of_the_workbench_end_to_end; +pub(crate) mod the_unsaved_marker_tells_the_truth; +pub(crate) mod the_viewport_draws_every_edit; +pub(crate) mod the_viewport_picks_every_line_it_draws; +pub(crate) mod the_viewport_picks_what_it_draws; +pub(crate) mod the_wardrobe_edit_operations; +pub(crate) mod the_wardrobe_import_breadth; +pub(crate) mod the_wardrobe_workspace; +pub(crate) mod the_world_screen_adds_and_copies; +pub(crate) mod the_world_screen_edits_a_project; +pub(crate) mod the_world_screen_has_a_manipulator; +pub(crate) mod the_world_screen_shows_layers; +pub(crate) mod the_world_screen_takes_its_keys_as_commands; +pub(crate) mod two_readers_of_one_archive_across_a_save; +pub(crate) mod undo_and_the_sliders_follow_the_pinned_inspector; +pub(crate) mod undo_from_files_acts_on_what_files_shows; +pub(crate) mod uses_and_used_by_in_the_app; +pub(crate) mod uses_over_a_retail_install; +pub(crate) mod uses_reaches_every_pack; +pub(crate) mod viewing_never_edits; +pub(crate) mod viewport_basics_for_inspecting_assets; +pub(crate) mod what_a_comparison_still_missed; +pub(crate) mod what_archive_rows_still_get_wrong; +pub(crate) mod what_the_create_menu_offers; + +use std::path::{Path, PathBuf}; + +use super::{ + load_prefs_from, save_destination, AppState, DocPayload, Document, DocumentKind, RpfDocument, + RpfEditSession, RpfEntryBinding, Workspace, +}; fn fresh_state() -> AppState { let mut state = AppState::new(); diff --git a/src/state/nested_archives_survive_a_save.rs b/src/state/tests/nested_archives_survive_a_save.rs similarity index 89% rename from src/state/nested_archives_survive_a_save.rs rename to src/state/tests/nested_archives_survive_a_save.rs index 0c1d306f5..ca42becaf 100644 --- a/src/state/nested_archives_survive_a_save.rs +++ b/src/state/tests/nested_archives_survive_a_save.rs @@ -7,17 +7,19 @@ use std::time::{Duration, Instant}; use or_io::container::rpf::{BodyForm, RpfArchive}; -use super::document::{DocumentId, TextDocument}; use super::opening_a_ydd::{finish_load, node_at}; -use super::prefs::EditMode; -use super::save_destination::SaveDestination; -use super::{AppState, DocPayload, DocumentKind, RetailEditDecision, RpfOutputMode, ToastType}; +use crate::state::document::{DocumentId, TextDocument}; +use crate::state::prefs::EditMode; +use crate::state::save_destination::SaveDestination; +use crate::state::{ + AppState, DocPayload, DocumentKind, RetailEditDecision, RpfOutputMode, ToastType, +}; -pub(super) const EDITED: &[u8] = b"edited"; +pub(in crate::state) const EDITED: &[u8] = b"edited"; /// An unencrypted archive of `entries`. -pub(super) fn archive(entries: &[(&str, &[u8])]) -> Vec { - super::document_io::serialize_archive_records( +pub(in crate::state) fn archive(entries: &[(&str, &[u8])]) -> Vec { + crate::state::document_io::serialize_archive_records( entries .iter() .map(|(path, bytes)| (path.to_string(), bytes.to_vec(), false)) @@ -30,12 +32,12 @@ pub(super) fn archive(entries: &[(&str, &[u8])]) -> Vec { /// How a test opens `outer.rpf`. #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub(super) enum Opened { +pub(in crate::state) enum Opened { InAnInstallTree, } /// `outer` written to `root/outer.rpf` and opened `how`: the document holding it, the file, and the prefix of a path inside it. -pub(super) fn open( +pub(in crate::state) fn open( state: &mut AppState, root: &Path, outer: &[u8], @@ -58,7 +60,7 @@ pub(super) fn open( } /// What the app reported going wrong. -pub(super) fn errors(state: &AppState) -> Vec { +pub(in crate::state) fn errors(state: &AppState) -> Vec { state .toasts .iter() @@ -68,7 +70,7 @@ pub(super) fn errors(state: &AppState) -> Vec { } /// Save `doc` as Ctrl+S does, and wait for a save that runs on a thread. -pub(super) fn save(state: &mut AppState, doc: DocumentId) { +pub(in crate::state) fn save(state: &mut AppState, doc: DocumentId) { state.set_active_document(doc); assert!(state.save_active_document(), "{:?}", errors(state)); let deadline = Instant::now() + Duration::from_secs(60); @@ -79,8 +81,8 @@ pub(super) fn save(state: &mut AppState, doc: DocumentId) { } } -pub(super) fn on_disk(state: &AppState, path: &Path) -> Arc { - super::rpf_archive_open::open_archive_from_disk(path, state.keys.provider()) +pub(in crate::state) fn on_disk(state: &AppState, path: &Path) -> Arc { + crate::state::rpf_archive_open::open_archive_from_disk(path, state.keys.provider()) .expect("the saved archive opens") } @@ -93,14 +95,14 @@ fn index_of(archive: &RpfArchive, name: &str) -> u32 { .entry_index() } -pub(super) fn body(archive: &RpfArchive, name: &str, form: BodyForm) -> Vec { +pub(in crate::state) fn body(archive: &RpfArchive, name: &str, form: BodyForm) -> Vec { archive .read_form(index_of(archive, name), form) .unwrap_or_else(|e| panic!("{name} does not read: {e}")) } /// The archive `archive` holds as `name`, opened from its stored bytes as the game opens it. -pub(super) fn nested(archive: &Arc, name: &str) -> Arc { +pub(in crate::state) fn nested(archive: &Arc, name: &str) -> Arc { let opened = archive.open_nested(index_of(archive, name)); Arc::new(opened.unwrap_or_else(|e| panic!("{name} no longer opens as an archive: {e}"))) } diff --git a/src/state/no_save_replaces_a_file_a_job_reads.rs b/src/state/tests/no_save_replaces_a_file_a_job_reads.rs similarity index 90% rename from src/state/no_save_replaces_a_file_a_job_reads.rs rename to src/state/tests/no_save_replaces_a_file_a_job_reads.rs index ceb514c70..784340a25 100644 --- a/src/state/no_save_replaces_a_file_a_job_reads.rs +++ b/src/state/tests/no_save_replaces_a_file_a_job_reads.rs @@ -11,24 +11,24 @@ use std::time::{Duration, Instant}; use or_io::container::rpf::BodyForm; use super::a_moved_or_deleted_archive_row_leaves_nothing_behind::folder_of; -use super::document::{DocumentId, TextDocument}; -use super::document_io::empty_file_bytes_for_kind; use super::every_add_lands_where_the_tree_shows_it::opened; -use super::jobs::JobKind; use super::nested_archives_survive_a_save::{archive, body, errors, on_disk, save, EDITED}; use super::opening_a_ydd::{finish_load, node_at}; -use super::save_destination::SaveDestination; -use super::{AppState, DocPayload, DocumentKind}; +use crate::state::document::{DocumentId, TextDocument}; +use crate::state::document_io::empty_file_bytes_for_kind; +use crate::state::jobs::JobKind; +use crate::state::save_destination::SaveDestination; +use crate::state::{AppState, DocPayload, DocumentKind}; const DEADLINE: Duration = Duration::from_secs(60); -pub(super) const CONVERSION: &str = "conversion of prop.ydr"; +pub(in crate::state) const CONVERSION: &str = "conversion of prop.ydr"; -pub(super) fn running(state: &AppState, kind: JobKind) -> bool { +pub(in crate::state) fn running(state: &AppState, kind: JobKind) -> bool { (state.running_jobs().iter()).any(|job| job.kind == kind) } /// Tick the jobs until the one of `kind` has ended. -pub(super) fn ended(state: &mut AppState, kind: JobKind) { +pub(in crate::state) fn ended(state: &mut AppState, kind: JobKind) { let until = Instant::now() + DEADLINE; while running(state, kind) { assert!(Instant::now() < until, "the {kind:?} job never ended"); @@ -37,12 +37,12 @@ pub(super) fn ended(state: &mut AppState, kind: JobKind) { } } -pub(super) fn named(state: &AppState, job: &str) -> bool { +pub(in crate::state) fn named(state: &AppState, job: &str) -> bool { errors(state).iter().any(|e| e.contains(job)) } /// Wait for a save on a worker, if one started. -pub(super) fn written(state: &mut AppState) { +pub(in crate::state) fn written(state: &mut AppState) { let until = Instant::now() + DEADLINE; while state.save_receiver.is_some() { assert!(Instant::now() < until, "the save never finished"); @@ -52,7 +52,7 @@ pub(super) fn written(state: &mut AppState) { } /// `doc` edited to hold `bytes`. -pub(super) fn edit(state: &mut AppState, doc: DocumentId, bytes: &[u8]) { +pub(in crate::state) fn edit(state: &mut AppState, doc: DocumentId, bytes: &[u8]) { let doc = state.document_mut(doc).expect("the document is open"); match &mut doc.payload { DocPayload::Hex(hex) => hex.bytes = bytes.to_vec(), @@ -62,7 +62,7 @@ pub(super) fn edit(state: &mut AppState, doc: DocumentId, bytes: &[u8]) { } /// `a.rpf`: a drawable to convert, two texts to compare and a note to edit. -pub(super) fn shipped() -> Vec { +pub(in crate::state) fn shipped() -> Vec { let ydr = empty_file_bytes_for_kind(DocumentKind::Ydr).expect("a blank drawable"); archive(&[ ("prop.ydr", &ydr), @@ -73,7 +73,7 @@ pub(super) fn shipped() -> Vec { } /// `a.rpf` in a folder opened in the app, with its drawable being converted: the state, the folder's tree and the archive's path. -pub(super) fn converting(root: &Path) -> (AppState, DocumentId, PathBuf) { +pub(in crate::state) fn converting(root: &Path) -> (AppState, DocumentId, PathBuf) { let (mut state, tree) = folder_of(root, &[("a.rpf", shipped())]); let prop = node_at(&mut state, tree, "a.rpf/prop.ydr"); state.convert_rows(tree, vec![prop]); @@ -86,7 +86,7 @@ pub(super) fn converting(root: &Path) -> (AppState, DocumentId, PathBuf) { } /// `a.rpf`'s note edited and its tree saved, while a job reads `a.rpf`. -pub(super) fn save_the_note(state: &mut AppState, tree: DocumentId) { +pub(in crate::state) fn save_the_note(state: &mut AppState, tree: DocumentId) { let notes = node_at(state, tree, "a.rpf/notes.txt"); state .update_rpf_entry_bytes(tree, notes, EDITED.to_vec()) @@ -95,7 +95,7 @@ pub(super) fn save_the_note(state: &mut AppState, tree: DocumentId) { } /// Whether the archive at `path` still holds what it was written with. -pub(super) fn kept(path: &Path) -> bool { +pub(in crate::state) fn kept(path: &Path) -> bool { std::fs::read(path).ok() == Some(shipped()) } diff --git a/src/state/nothing_draws_over_what_it_belongs_to.rs b/src/state/tests/nothing_draws_over_what_it_belongs_to.rs similarity index 85% rename from src/state/nothing_draws_over_what_it_belongs_to.rs rename to src/state/tests/nothing_draws_over_what_it_belongs_to.rs index 5549c18cd..3fe1cdfba 100644 --- a/src/state/nothing_draws_over_what_it_belongs_to.rs +++ b/src/state/tests/nothing_draws_over_what_it_belongs_to.rs @@ -7,18 +7,18 @@ use egui::{Rect, Vec2}; use or_io::codec::texture::GrcTextureFormat; use or_io::gta5::{gen8, PgDictionary}; -use super::{ - textures, AppState, DocPayload, Document, DocumentId, Prefs, TextDocument, TextureListing, -}; use crate::state::AppearancePrefs; use crate::state::Workspace; +use crate::state::{ + textures, AppState, DocPayload, Document, DocumentId, Prefs, TextDocument, TextureListing, +}; use crate::ui::dock::Tab; -pub(super) fn window((width, height): (u32, u32)) -> Vec2 { +pub(in crate::state) fn window((width, height): (u32, u32)) -> Vec2 { egui::vec2(width as f32, height as f32) } -pub(super) fn input(screen: Vec2, time: f64, events: Vec) -> egui::RawInput { +pub(in crate::state) fn input(screen: Vec2, time: f64, events: Vec) -> egui::RawInput { let modifiers = events .iter() .find_map(|event| match event { @@ -36,7 +36,7 @@ pub(super) fn input(screen: Vec2, time: f64, events: Vec) -> egui:: } /// The context the editor draws with: its fonts, its spacing and its theme. -pub(super) fn app_context() -> egui::Context { +pub(in crate::state) fn app_context() -> egui::Context { crate::app::gpu::configured_egui_context(None, &AppearancePrefs::default()) } @@ -61,7 +61,7 @@ fn panel(workspace: Workspace, tab: Tab, screen: Vec2) -> Rect { /// The panel at the default window, and the same panel as narrow as the /// Inspector's column, the narrowest the default layouts make, at the smallest window. -pub(super) fn default_and_narrow(workspace: Workspace, tab: Tab) -> [Rect; 2] { +pub(in crate::state) fn default_and_narrow(workspace: Workspace, tab: Tab) -> [Rect; 2] { let default = panel(workspace, tab, window(crate::app::EDITOR_SIZE)); let narrowest = panel( Workspace::Particle, @@ -73,14 +73,14 @@ pub(super) fn default_and_narrow(workspace: Workspace, tab: Tab) -> [Rect; 2] { } /// Frames of one panel given `rect`, as a dock tab gives it, on a screen the size of the default window. -pub(super) struct Panel { - pub(super) ctx: egui::Context, - pub(super) rect: Rect, +pub(in crate::state) struct Panel { + pub(in crate::state) ctx: egui::Context, + pub(in crate::state) rect: Rect, time: f64, } impl Panel { - pub(super) fn new(rect: Rect) -> Self { + pub(in crate::state) fn new(rect: Rect) -> Self { let ctx = app_context(); ctx.enable_accesskit(); Self { @@ -90,7 +90,7 @@ impl Panel { } } - pub(super) fn frame( + pub(in crate::state) fn frame( &mut self, events: Vec, mut draw: impl FnMut(&mut egui::Ui), @@ -109,13 +109,13 @@ impl Panel { /// A text a frame painted: what it says, where, and the rectangle it was clipped to. #[derive(Debug)] -pub(super) struct Painted { - pub(super) text: String, - pub(super) rect: Rect, - pub(super) clip: Rect, +pub(in crate::state) struct Painted { + pub(in crate::state) text: String, + pub(in crate::state) rect: Rect, + pub(in crate::state) clip: Rect, } -pub(super) fn painted(output: &egui::FullOutput) -> Vec { +pub(in crate::state) fn painted(output: &egui::FullOutput) -> Vec { fn walk(shape: &egui::Shape, clip: Rect, out: &mut Vec) { match shape { egui::Shape::Text(text) => out.push(Painted { @@ -135,7 +135,7 @@ pub(super) fn painted(output: &egui::FullOutput) -> Vec { } /// Every widget a frame drew that says something, and its rectangle. -pub(super) fn widgets(output: &egui::FullOutput) -> Vec<(String, Rect)> { +pub(in crate::state) fn widgets(output: &egui::FullOutput) -> Vec<(String, Rect)> { let Some(update) = &output.platform_output.accesskit_update else { return Vec::new(); }; @@ -153,7 +153,7 @@ pub(super) fn widgets(output: &egui::FullOutput) -> Vec<(String, Rect)> { } /// Where each area drawn over the panels sat in the last frame. -pub(super) fn areas_over_the_panels(ctx: &egui::Context) -> Vec { +pub(in crate::state) fn areas_over_the_panels(ctx: &egui::Context) -> Vec { ctx.memory(|m| { (m.areas().visible_layer_ids().into_iter()) .filter(|layer| layer.order == egui::Order::Foreground) @@ -162,12 +162,12 @@ pub(super) fn areas_over_the_panels(ctx: &egui::Context) -> Vec { }) } -pub(super) fn within(outer: Rect, inner: Rect) -> bool { +pub(in crate::state) fn within(outer: Rect, inner: Rect) -> bool { outer.expand(0.01).contains_rect(inner) } /// Forty lines, each wider than any panel, so whatever sits on one covers its text. -pub(super) fn long_lines() -> String { +pub(in crate::state) fn long_lines() -> String { (1..=40) .map(|n| format!("line {n}: {}", "a word that runs on ".repeat(12))) .collect::>() @@ -175,7 +175,7 @@ pub(super) fn long_lines() -> String { } /// `text` open in the editor as `C:/mods/`, in the Data workspace. -pub(super) fn editing(name: &str, text: &str) -> AppState { +pub(in crate::state) fn editing(name: &str, text: &str) -> AppState { let mut state = AppState::from_prefs(Prefs::default()); state.documents.clear(); let id: DocumentId = crate::state::DocumentId(4243); @@ -190,7 +190,7 @@ pub(super) fn editing(name: &str, text: &str) -> AppState { } /// The editor's own lines (their numbers and their text) and every other text it painted. -pub(super) fn lines_and_the_rest( +pub(in crate::state) fn lines_and_the_rest( output: &egui::FullOutput, text: &str, ) -> (Vec, Vec) { @@ -199,7 +199,7 @@ pub(super) fn lines_and_the_rest( .partition(|p| p.text.parse::().is_ok() || text.lines().any(|line| line == p.text)) } -pub(super) fn draw_editor( +pub(in crate::state) fn draw_editor( panel: &mut Panel, state: &mut AppState, events: Vec, @@ -208,7 +208,7 @@ pub(super) fn draw_editor( } /// A dictionary of one DXT1 texture with six mips and a long name, selected in the texture view. -pub(super) fn a_texture_on_screen() -> AppState { +pub(in crate::state) fn a_texture_on_screen() -> AppState { let mut dictionary = PgDictionary::default(); // 128×128 down to 4×4 in eight-byte 4×4 blocks. let bytes: usize = (0..6).map(|level| ((32usize >> level).pow(2)) * 8).sum(); diff --git a/src/state/nothing_extracts_into_an_install.rs b/src/state/tests/nothing_extracts_into_an_install.rs similarity index 93% rename from src/state/nothing_extracts_into_an_install.rs rename to src/state/tests/nothing_extracts_into_an_install.rs index 405bad504..9aaf56995 100644 --- a/src/state/nothing_extracts_into_an_install.rs +++ b/src/state/tests/nothing_extracts_into_an_install.rs @@ -16,11 +16,11 @@ use std::time::{Duration, Instant}; use or_io::container::rpf::BodyForm; -use super::document::{Document, DocumentId, RpfNodeId}; -use super::extract_job::{ExtractStart, TypeFilter}; -use super::prefs::EditMode; -use super::rpf_session::{RpfDocument, RpfEditSession}; -use super::{AppState, DocPayload, RetailEditDecision}; +use crate::state::document::{Document, DocumentId, RpfNodeId}; +use crate::state::extract_job::{ExtractStart, TypeFilter}; +use crate::state::prefs::EditMode; +use crate::state::rpf_session::{RpfDocument, RpfEditSession}; +use crate::state::{AppState, DocPayload, RetailEditDecision}; /// An install as far as [`classify`](super::retail::classify) is concerned: a /// directory with a game executable in it. @@ -69,7 +69,7 @@ fn state_holding_two_entries() -> (AppState, DocumentId, RpfNodeId) { /// ⚠ Deliberately `poll_extract_job` rather than a test-only wait: the tick is /// where a result is supposed to arrive, so a job that finishes and never /// reaches it hangs here rather than passing. -pub(super) fn run_to_completion(state: &mut AppState) { +pub(in crate::state) fn run_to_completion(state: &mut AppState) { let deadline = Instant::now() + Duration::from_secs(30); while state.extract_jobs.is_running() { state.poll_extract_job(); @@ -80,7 +80,7 @@ pub(super) fn run_to_completion(state: &mut AppState) { } } -pub(super) fn files_under(dir: &Path) -> Vec { +pub(in crate::state) fn files_under(dir: &Path) -> Vec { let mut out = Vec::new(); let mut stack = vec![dir.to_path_buf()]; while let Some(next) = stack.pop() { diff --git a/src/state/one_place_for_background_jobs.rs b/src/state/tests/one_place_for_background_jobs.rs similarity index 93% rename from src/state/one_place_for_background_jobs.rs rename to src/state/tests/one_place_for_background_jobs.rs index bd5e31fd7..29363e13b 100644 --- a/src/state/one_place_for_background_jobs.rs +++ b/src/state/tests/one_place_for_background_jobs.rs @@ -8,8 +8,8 @@ use std::time::{Duration, Instant}; use or_io::container::rpf::crypto::NoOpCryptoProvider; use or_job::{Cancel, Step}; -use super::jobs::{JobKind, Outcome}; -use super::{AppState, ExtractionResult, SaveResult}; +use crate::state::jobs::{JobKind, Outcome}; +use crate::state::{AppState, ExtractionResult, SaveResult}; const ALL: [JobKind; 16] = [ JobKind::Extraction, @@ -82,11 +82,11 @@ fn every_kind_running(scratch: &Path) -> AppState { |progress, cancel| { progress.reached(1, 4); until_stopped(cancel); - super::defrag_job::Outcome::Stopped + crate::state::defrag_job::Outcome::Stopped }, ); state.overlay_copy.start( - super::overlay_copy::OverlayCopyOffer { + crate::state::overlay_copy::OverlayCopyOffer { source: scratch.join("update.rpf"), dest: scratch.join("mods").join("update.rpf"), bytes: 2048, @@ -99,9 +99,9 @@ fn every_kind_running(scratch: &Path) -> AppState { }, ); state.search.start( - super::search_session::SearchRequest { + crate::state::search_session::SearchRequest { pattern: "railgun".into(), - mode: super::search_session::SearchMode::Text, + mode: crate::state::search_session::SearchMode::Text, case_sensitive: false, extensions: Vec::new(), under: String::new(), @@ -166,20 +166,20 @@ fn every_kind_running(scratch: &Path) -> AppState { .compare .start("a.ymt ↔ b.ymt".into(), Vec::new(), |_| { std::thread::sleep(DEADLINE); - super::compare::Ended::Failed("stopped".into()) + crate::state::compare::Ended::Failed("stopped".into()) }); - (state.texture_naming).push(super::gta6_texture_naming::TextureNaming::run( + (state.texture_naming).push(crate::state::gta6_texture_naming::TextureNaming::run( "Naming".into(), |cancel, _| { until_stopped(cancel); - super::gta6_texture_naming::NamingEnded::Stopped + crate::state::gta6_texture_naming::NamingEnded::Stopped }, )); state } /// Draws the status bar, returning each labelled widget and its centre. -pub(super) fn frame( +pub(in crate::state) fn frame( ctx: &egui::Context, state: &mut AppState, events: Vec, @@ -212,7 +212,7 @@ pub(super) fn frame( .unwrap_or_default() } -pub(super) fn click(ctx: &egui::Context, state: &mut AppState, naming: &str) { +pub(in crate::state) fn click(ctx: &egui::Context, state: &mut AppState, naming: &str) { let shown = frame(ctx, state, Vec::new()); let at = shown .iter() @@ -445,13 +445,13 @@ fn the_kinds_the_list_test_runs_are_those_no_other_test_holds() { include_str!("one_place_for_background_jobs.rs"), include_str!("opening_an_rpf9_archive.rs"), include_str!("opening_a_gta_vi_body.rs"), - include_str!("gta6_set_finding_tests.rs"), - include_str!("gta6_map_tests.rs"), - include_str!("gta6_audio_links_tests.rs"), + include_str!("../gta6/anim/gta6_set_finding/tests.rs"), + include_str!("../gta6/world/gta6_map/tests.rs"), + include_str!("../gta6/audio/gta6_audio_links/tests.rs"), include_str!("opus_on_a_worker.rs"), - include_str!("gta6_bcpack_calibration.rs"), - include_str!("gta6_modding/text_search_tests.rs"), - include_str!("gta6_modding/mod_package_tests.rs"), + include_str!("../ttpf_document/calibration.rs"), + include_str!("../gta6/modding/text_search/tests.rs"), + include_str!("../gta6/modding/mod_package/tests.rs"), ]; for test in named { let defined = sources diff --git a/src/state/opening_a_dds.rs b/src/state/tests/opening_a_dds.rs similarity index 93% rename from src/state/opening_a_dds.rs rename to src/state/tests/opening_a_dds.rs index 5b21f5b98..32ef7c246 100644 --- a/src/state/opening_a_dds.rs +++ b/src/state/tests/opening_a_dds.rs @@ -8,8 +8,8 @@ use or_io::authoring::{FormatChoice, TextureBuildOptions}; use or_io::codec::texture::{decode_level, format_of_dds, GrcTextureFormat, RgbaImage}; use or_io::dds::{caps, caps2, header_flags, pixel_format_flags, Dds, DdsHeader}; -use super::textures::{self, TextureSource}; -use super::{AppState, DocPayload, DocumentId, LoadingState}; +use crate::state::textures::{self, TextureSource}; +use crate::state::{AppState, DocPayload, DocumentId, LoadingState}; /// Each level's one solid colour, as RGB565 and as the RGBA it decodes to. const LEVELS: [(u16, [u8; 4]); 4] = [ @@ -119,8 +119,9 @@ fn a_replaced_dds_saves_back_as_dds() { (GrcTextureFormat::DXT5, false) ); assert_eq!(saved.header.mip_map_count, 5); - let reopened = - DocPayload::Dds(super::dds_document::open("saved", &saved).expect("the save reopens")); + let reopened = DocPayload::Dds( + crate::state::dds_document::open("saved", &saved).expect("the save reopens"), + ); let texture = textures::texture_at(&reopened, TextureSource::Document, "saved") .expect("the reopened texture"); let top = decode_level(&texture, 0).expect("decodes"); @@ -131,6 +132,6 @@ fn a_replaced_dds_saves_back_as_dds() { fn a_cube_map_is_refused_rather_than_cut_to_one_face() { let mut cube = eight_by_eight_dxt1(); cube.header.caps2 = caps2::CUBEMAP; - let error = super::dds_document::open("sky", &cube).unwrap_err(); + let error = crate::state::dds_document::open("sky", &cube).unwrap_err(); assert!(error.contains("cube"), "unhelpful: {error}"); } diff --git a/src/state/opening_a_gta_vi_awc.rs b/src/state/tests/opening_a_gta_vi_awc.rs similarity index 96% rename from src/state/opening_a_gta_vi_awc.rs rename to src/state/tests/opening_a_gta_vi_awc.rs index 24e5b549d..8b25f2d0b 100644 --- a/src/state/opening_a_gta_vi_awc.rs +++ b/src/state/tests/opening_a_gta_vi_awc.rs @@ -7,10 +7,10 @@ use std::path::PathBuf; use super::opening_an_awc::{opened, three_streams, PACKET}; -use super::{AppState, DocumentId}; +use crate::state::{AppState, DocumentId}; /// `count` Opus packets of one 20 ms frame, each a TOC byte and nonzero bytes. -pub(super) fn opus_packets(toc: u8, count: usize) -> Vec> { +pub(in crate::state) fn opus_packets(toc: u8, count: usize) -> Vec> { (0..count) .map(|i| { let mut p = vec![toc]; @@ -52,7 +52,7 @@ fn per_channel(frames: usize) -> u32 { /// A single Opus stream's chunks: its format record, its data, and a seek table of each /// packet's first sample and the last frame's. -pub(super) fn opus_single(packets: &[Vec], channels: u8, loop_point: i32) -> Chunks { +pub(in crate::state) fn opus_single(packets: &[Vec], channels: u8, loop_point: i32) -> Chunks { let (data, counts) = opus_units(packets); let step = 960 * u32::from(channels); let samples = per_channel(packets.len()); @@ -75,7 +75,7 @@ pub(super) fn opus_single(packets: &[Vec], channels: u8, loop_point: i32) -> /// A container in GTA VI's layout: flag bits 0 and 5, a word when bit 6 is set, the first-chunk /// index, `streams + 1` words, the stream and chunk tables, then payloads on 16-byte steps. -pub(super) fn gta_vi(flags: u16, streams: &[(u32, Chunks)]) -> Vec { +pub(in crate::state) fn gta_vi(flags: u16, streams: &[(u32, Chunks)]) -> Vec { let mut out = b"ADAT".to_vec(); out.extend(1u16.to_le_bytes()); out.extend(flags.to_le_bytes()); @@ -193,7 +193,7 @@ fn frame( } } let draw = (state.document(doc)) - .and_then(|d| super::capabilities::for_payload(&d.payload)) + .and_then(|d| crate::state::capabilities::for_payload(&d.payload)) .and_then(|row| row.inspector) .expect("an .awc has a view"); let input = egui::RawInput { diff --git a/src/state/opening_a_gta_vi_body.rs b/src/state/tests/opening_a_gta_vi_body.rs similarity index 90% rename from src/state/opening_a_gta_vi_body.rs rename to src/state/tests/opening_a_gta_vi_body.rs index 7f36e77eb..f74ecb9d0 100644 --- a/src/state/opening_a_gta_vi_body.rs +++ b/src/state/tests/opening_a_gta_vi_body.rs @@ -3,15 +3,15 @@ use std::time::{Duration, Instant}; -use super::jobs::JobKind; use super::opening_an_rpf9_archive::{ le32, row_at, rows, rpf9_head, said, scanned, settle, written, zlib, }; -use super::{AppState, ToastType}; +use crate::state::jobs::JobKind; +use crate::state::{AppState, ToastType}; /// The virtual section of a GTA VI bound: a composite of one geometry child, placed 10 m along X, /// that holds a triangle of 1 m legs and a capsule. -pub(super) fn bound_body() -> Vec { +pub(in crate::state) fn bound_body() -> Vec { const V: u64 = 0x5000_0000; let mut v = vec![0u8; 0x400]; let put = @@ -73,8 +73,8 @@ pub(super) fn bound_body() -> Vec { #[test] fn the_cells_across_a_gta_vi_cell_s_borders_are_found_in_its_scan_as_a_job_and_open() { - use super::jobs::Outcome; use super::opening_an_rpf9_archive::navmesh_cell; + use crate::state::jobs::Outcome; let cell = |index: u32| { let mut v = navmesh_cell(); v[0xC8..0xCC].copy_from_slice(&le32(index)); @@ -103,9 +103,9 @@ fn the_cells_across_a_gta_vi_cell_s_borders_are_found_in_its_scan_as_a_job_and_o .and_then(|d| d.path.clone()) .expect("a path"); let joins = || { - let m = super::gta6_navmesh::scanned_cell(&path).expect("the cell"); - let near = super::gta6_navmesh::neighbours(&path, &m); - super::gta6_navmesh::join_lines(&m, &near).join("\n") + let m = crate::state::gta6_navmesh::scanned_cell(&path).expect("the cell"); + let near = crate::state::gta6_navmesh::neighbours(&path, &m); + crate::state::gta6_navmesh::join_lines(&m, &near).join("\n") }; let east_unjoined = format!("Cell {}, across the east border, has no body", here + 1); assert!(joins().contains(&east_unjoined), "{}", joins()); @@ -121,14 +121,15 @@ fn the_cells_across_a_gta_vi_cell_s_borders_are_found_in_its_scan_as_a_job_and_o let finds: Vec<_> = (rows(&state, doc).into_iter()) .filter_map(|r| match r { - super::rpf9_scan::Row::Body(find) => Some(*find), + crate::state::rpf9_scan::Row::Body(find) => Some(*find), _ => None, }) .collect(); let stopped = or_job::Cancel::new(); stopped.set(); let progress = or_job::Progress::new(); - let found = super::gta6_navmesh::find_cells(&archive, &finds, &[here + 1], &stopped, &progress); + let found = + crate::state::gta6_navmesh::find_cells(&archive, &finds, &[here + 1], &stopped, &progress); assert_eq!(found, Err(None), "a stopped search reads nothing"); state.find_neighbour_cells(opened); @@ -142,7 +143,10 @@ fn the_cells_across_a_gta_vi_cell_s_borders_are_found_in_its_scan_as_a_job_and_o assert!(Instant::now() < deadline, "the search never ended"); std::thread::sleep(Duration::from_millis(5)); }; - assert_eq!(ended.outcome, Outcome::Done(super::jobs::Then::Nothing)); + assert_eq!( + ended.outcome, + Outcome::Done(crate::state::jobs::Then::Nothing) + ); assert!(ended.said.contains("1 neighbouring cell"), "{}", ended.said); settle(&mut state); let open = |offset: u64| { @@ -172,7 +176,7 @@ fn sgd5_head(records: u8) -> Vec { #[test] fn an_effect_container_is_read_as_a_job_with_progress_that_stops_when_asked_and_says_how_it_ended() { - use super::jobs::Outcome; + use crate::state::jobs::Outcome; let mut bytes = rpf9_head(1, 0x1A0); bytes.resize(0x1000, 0); bytes.extend(sgd5_head(3)); @@ -204,7 +208,10 @@ fn an_effect_container_is_read_as_a_job_with_progress_that_stops_when_asked_and_ assert!(Instant::now() < deadline, "the read never ended"); std::thread::sleep(Duration::from_millis(5)); }; - assert_eq!(ended.outcome, Outcome::Stopped(super::jobs::Then::Nothing)); + assert_eq!( + ended.outcome, + Outcome::Stopped(crate::state::jobs::Then::Nothing) + ); assert!(state .running_jobs() .iter() diff --git a/src/state/opening_a_nametable.rs b/src/state/tests/opening_a_nametable.rs similarity index 97% rename from src/state/opening_a_nametable.rs rename to src/state/tests/opening_a_nametable.rs index 0ac133fae..e05f198fc 100644 --- a/src/state/opening_a_nametable.rs +++ b/src/state/tests/opening_a_nametable.rs @@ -6,7 +6,7 @@ use std::time::{Duration, Instant}; use or_io::gta5::data::nametable; -use super::{AppState, DocPayload, DocumentId, DocumentKind, LoadingState}; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind, LoadingState}; fn open(state: &mut AppState, path: PathBuf) -> DocumentId { state.load_file(path); diff --git a/src/state/opening_a_rel.rs b/src/state/tests/opening_a_rel.rs similarity index 98% rename from src/state/opening_a_rel.rs rename to src/state/tests/opening_a_rel.rs index 2b3b2ada5..0e0c3eaf5 100644 --- a/src/state/opening_a_rel.rs +++ b/src/state/tests/opening_a_rel.rs @@ -10,7 +10,7 @@ use std::time::{Duration, Instant}; use or_io::rel::sound::SoundItem; use or_io::rel::TypedItem; -use super::{AppState, DocPayload, DocumentId, DocumentKind, LoadingState, RelDocument}; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind, LoadingState, RelDocument}; fn word(out: &mut Vec, w: u32) { out.extend_from_slice(&w.to_le_bytes()); diff --git a/src/state/opening_a_ttpf.rs b/src/state/tests/opening_a_ttpf.rs similarity index 89% rename from src/state/opening_a_ttpf.rs rename to src/state/tests/opening_a_ttpf.rs index 3ecc49b96..1aa7fbf78 100644 --- a/src/state/opening_a_ttpf.rs +++ b/src/state/tests/opening_a_ttpf.rs @@ -9,20 +9,20 @@ use std::time::{Duration, Instant}; use or_io::codec::texture::decode_level; -use super::textures::{self, TextureSource}; -use super::{AppState, DocPayload, DocumentId, DocumentKind, LoadingState}; +use crate::state::textures::{self, TextureSource}; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind, LoadingState}; /// A 128x64 BC1 texture is 32x16 blocks: one 4 KiB tile, so a solid colour reads whatever the tiling. -pub(super) const SIDE: (u32, u32) = (128, 64); +pub(in crate::state) const SIDE: (u32, u32) = (128, 64); /// Each texture's decoded size. -pub(super) const BODY: usize = 0x1000; +pub(in crate::state) const BODY: usize = 0x1000; /// A format code whose DXGI number, 34, has no measured element. const NOT_BC: u16 = 0x110; /// A pack laid out as the container is measured to be, one body per texture: its format code, its /// codec kind and its stored bytes, which a stored body decodes to and any other kind to [`BODY`] /// bytes. -pub(super) fn pack_of(textures: &[(u16, u8, Vec)]) -> Vec { +pub(in crate::state) fn pack_of(textures: &[(u16, u8, Vec)]) -> Vec { let count = textures.len() as u64; let directory = (16 + 8 * (count + 2)).next_multiple_of(0x100); let directory_len = (16 + 32 * count).next_multiple_of(0x1000); @@ -69,13 +69,13 @@ pub(super) fn pack_of(textures: &[(u16, u8, Vec)]) -> Vec { } /// Two stored textures: a BC1 one of solid `rgb565`, then one whose format is not BC. -pub(super) fn pack(rgb565: u16) -> Vec { +pub(in crate::state) fn pack(rgb565: u16) -> Vec { let [lo, hi] = rgb565.to_le_bytes(); let solid = [lo, hi, lo, hi, 0, 0, 0, 0].repeat(BODY / 8); pack_of(&[(0x238, 0, solid.clone()), (NOT_BC, 0, solid)]) } -pub(super) fn open(state: &mut AppState, path: PathBuf) -> DocumentId { +pub(in crate::state) fn open(state: &mut AppState, path: PathBuf) -> DocumentId { state.load_file(path.clone()); let deadline = Instant::now() + Duration::from_secs(30); while state.load_receiver.is_some() && Instant::now() < deadline { @@ -93,14 +93,14 @@ pub(super) fn open(state: &mut AppState, path: PathBuf) -> DocumentId { .expect("the file opened as a document") } -pub(super) fn written(dir: &Path, bytes: &[u8]) -> PathBuf { +pub(in crate::state) fn written(dir: &Path, bytes: &[u8]) -> PathBuf { let path = dir.join("textures.ttpf"); std::fs::write(&path, bytes).expect("written"); path } /// Save As to `to`, waited for; whether the save was started. -pub(super) fn save_as(state: &mut AppState, doc: DocumentId, to: &Path) -> bool { +pub(in crate::state) fn save_as(state: &mut AppState, doc: DocumentId, to: &Path) -> bool { state.set_active_document(doc); let started = state.save_active_document_as(to.to_path_buf()); let until = Instant::now() + Duration::from_secs(60); @@ -176,7 +176,7 @@ fn a_ttpf_texture_replaced_from_an_image_saves_as_a_new_pack_that_reads_it_back( std::fs::read(&source).expect("read") == pack(0xF800), "the source is untouched" ); - assert!(super::document_io::why_not_authorable(DocumentKind::Ttpf).is_some()); + assert!(crate::state::document_io::why_not_authorable(DocumentKind::Ttpf).is_some()); } #[test] @@ -187,7 +187,7 @@ fn an_open_gta_vi_pack_supplies_no_texture_to_a_gta_v_document_and_one_to_a_gta_ bytes[keys..keys + 8].copy_from_slice(&key.to_le_bytes()); let dir = tempfile::tempdir().expect("a scratch directory"); let path = written(dir.path(), &bytes); - let ttpf = super::ttpf_document::TtpfDocument::open(&path).expect("the pack opens"); + let ttpf = crate::state::ttpf_document::TtpfDocument::open(&path).expect("the pack opens"); let mut state = AppState::new(); state.insert_document(path, DocPayload::Ttpf(Arc::new(ttpf)), None, None); let name = format!("hash_{key:016x}"); @@ -199,12 +199,12 @@ fn an_open_gta_vi_pack_supplies_no_texture_to_a_gta_v_document_and_one_to_a_gta_ None, ); assert!( - super::texture_resolution::resolve(&state, None, None, &name).is_none(), + crate::state::texture_resolution::resolve(&state, None, None, &name).is_none(), "a GTA V document is drawn with no GTA VI texture" ); drawn(&mut state, dir.path(), drawable_keyed(key)); assert!( - super::texture_resolution::resolve(&state, None, None, &name).is_some(), + crate::state::texture_resolution::resolve(&state, None, None, &name).is_some(), "a GTA VI drawable is drawn with the pack's texture" ); } @@ -226,7 +226,7 @@ fn a_ttpf_whose_bodies_are_not_on_disk_yet_opens_and_names_why() { } /// A GTA VI drawable of one triangle whose one shader binds `key` in its second slot, as its base colour. -pub(super) fn drawable_keyed(key: u64) -> or_io::gta6::headerless::Drawable { +pub(in crate::state) fn drawable_keyed(key: u64) -> or_io::gta6::headerless::Drawable { use or_io::gta6::headerless::{ Drawable, Geometry, Model, Parameter, ParameterValue, Shader, Vertices, }; @@ -271,7 +271,7 @@ pub(super) fn drawable_keyed(key: u64) -> or_io::gta6::headerless::Drawable { } /// Wait for the naming runs an open started to end, and say how they went as a frame does. -pub(super) fn named_by_the_rules(state: &mut AppState) { +pub(in crate::state) fn named_by_the_rules(state: &mut AppState) { let until = Instant::now() + Duration::from_secs(30); while state.texture_naming_jobs().next().is_some() && Instant::now() < until { std::thread::sleep(Duration::from_millis(2)); @@ -284,7 +284,7 @@ pub(super) fn named_by_the_rules(state: &mut AppState) { } /// Insert `drawable` as a scanned body, the active document, and the meshes the model view draws of it. -pub(super) fn drawn( +pub(in crate::state) fn drawn( state: &mut AppState, dir: &Path, drawable: or_io::gta6::headerless::Drawable, @@ -294,7 +294,7 @@ pub(super) fn drawn( let doc = state.insert_document(dir.join("0x10.drawable"), payload, None, None); named_by_the_rules(state); let state = &*state; - let request = super::capabilities::GeometryRequest { + let request = crate::state::capabilities::GeometryRequest { state, doc: state.document(doc).expect("open"), selection: None, diff --git a/src/state/opening_a_ydd.rs b/src/state/tests/opening_a_ydd.rs similarity index 94% rename from src/state/opening_a_ydd.rs rename to src/state/tests/opening_a_ydd.rs index 9ab798ef4..20a542ab8 100644 --- a/src/state/opening_a_ydd.rs +++ b/src/state/tests/opening_a_ydd.rs @@ -13,8 +13,8 @@ use or_io::desc::{Image, Record, Value}; use or_io::Generation; use or_test_support::{skip_corpus, Corpus}; -use super::document::{DocumentId, RpfNodeId}; -use super::{AppState, DocPayload, DocumentKind, LoadingState, RpfOutputMode}; +use crate::state::document::{DocumentId, RpfNodeId}; +use crate::state::{AppState, DocPayload, DocumentKind, LoadingState, RpfOutputMode}; fn wait_until(what: &str, mut done: impl FnMut() -> bool) { let deadline = Instant::now() + Duration::from_secs(120); @@ -24,7 +24,7 @@ fn wait_until(what: &str, mut done: impl FnMut() -> bool) { } } -pub(super) fn with_keys(root: &Path) -> AppState { +pub(in crate::state) fn with_keys(root: &Path) -> AppState { let mut state = AppState::default(); state.keys.start_extraction(root.join("GTA5.exe")); wait_until("the key extraction", || state.keys.poll().is_some()); @@ -37,7 +37,7 @@ pub(super) fn with_keys(root: &Path) -> AppState { } /// The node `path` names under the game root, each archive on the way expanded as the tree does. -pub(super) fn node_at(state: &mut AppState, game: DocumentId, path: &str) -> RpfNodeId { +pub(in crate::state) fn node_at(state: &mut AppState, game: DocumentId, path: &str) -> RpfNodeId { let mut node = match &state.document(game).expect("the game root").payload { DocPayload::Rpf(rpf) => rpf.session.root_id(), _ => unreachable!("the game root is an archive document"), @@ -66,7 +66,7 @@ pub(super) fn node_at(state: &mut AppState, game: DocumentId, path: &str) -> Rpf } /// The document a finished load left active, or the error it reported. -pub(super) fn finish_load(state: &mut AppState) -> Result { +pub(in crate::state) fn finish_load(state: &mut AppState) -> Result { wait_until("the load", || { state.poll_load_result(); state.load_receiver.is_none() @@ -187,7 +187,7 @@ fn a_ydd_whose_geometries_share_a_matrix_palette_opens_from_the_tree_and_from_di let root = dir.path().join("install"); std::fs::create_dir_all(&root).expect("the install root"); let archive = |name: &str, bytes: Vec| { - super::document_io::serialize_archive_records( + crate::state::document_io::serialize_archive_records( vec![(name.to_string(), bytes, false)], RpfOutputMode::Open, state.keys.provider(), diff --git a/src/state/opening_an_awc.rs b/src/state/tests/opening_an_awc.rs similarity index 97% rename from src/state/opening_an_awc.rs rename to src/state/tests/opening_an_awc.rs index 9ea023834..05fd230ba 100644 --- a/src/state/opening_an_awc.rs +++ b/src/state/tests/opening_an_awc.rs @@ -12,8 +12,8 @@ use or_io::awc::wav::{read_wav, wav_from_pcm16}; use or_io::awc::{AwcFile, AwcKey}; use or_media::Codec; -use super::{AppState, DocumentId, DocumentKind, LoadingState}; use crate::audio::{AudioOut, Heard, NullSink}; +use crate::state::{AppState, DocumentId, DocumentKind, LoadingState}; const PCM_ID: u32 = 0x0BAD_F00D & 0x1FFF_FFFF; const ADPCM_ID: u32 = 0x0123_4567; @@ -28,7 +28,7 @@ struct Built { data: Vec, } -pub(super) fn ramp(samples: u32) -> Vec { +pub(in crate::state) fn ramp(samples: u32) -> Vec { (0..samples as i32) .flat_map(|i| (((i * 137) % 20000 - 10000) as i16).to_le_bytes()) .collect() @@ -69,7 +69,7 @@ fn container(streams: &[Built]) -> Vec { out } -pub(super) fn three_streams() -> Vec { +pub(in crate::state) fn three_streams() -> Vec { container(&[ Built { id: PCM_ID, @@ -124,7 +124,7 @@ fn quiet(state: &mut AppState) -> Heard { heard } -pub(super) fn opened(bytes: &[u8]) -> (tempfile::TempDir, AppState, DocumentId, Heard) { +pub(in crate::state) fn opened(bytes: &[u8]) -> (tempfile::TempDir, AppState, DocumentId, Heard) { let dir = tempfile::tempdir().expect("a scratch directory"); let path = dir.path().join("sounds.awc"); std::fs::write(&path, bytes).expect("the container is written"); @@ -270,12 +270,12 @@ fn a_replaced_adpcm_stream_saves_and_reopens_within_adpcm_error() { /// What saving `doc` would write now. fn written(state: &AppState, doc: DocumentId) -> Vec { match state.document(doc).map(|d| &d.payload) { - Some(super::DocPayload::Awc(awc)) => awc.to_bytes().expect("the container writes"), + Some(crate::state::DocPayload::Awc(awc)) => awc.to_bytes().expect("the container writes"), _ => panic!("not an .awc document"), } } -pub(super) const PACKET: usize = 2048; +pub(in crate::state) const PACKET: usize = 2048; const ADPCM_PACKET_SAMPLES: usize = 4088; fn sine(hz: f64, amplitude: f64, rate: f64, samples: usize) -> Vec { diff --git a/src/state/opening_an_rpf9_archive.rs b/src/state/tests/opening_an_rpf9_archive.rs similarity index 90% rename from src/state/opening_an_rpf9_archive.rs rename to src/state/tests/opening_an_rpf9_archive.rs index 6072e813b..2fc3a43f5 100644 --- a/src/state/opening_an_rpf9_archive.rs +++ b/src/state/tests/opening_an_rpf9_archive.rs @@ -4,17 +4,17 @@ use std::path::{Path, PathBuf}; use std::time::{Duration, Instant}; -use super::jobs::JobKind; -use super::rpf9_scan::{Ended, Row}; -use super::{AppState, DocPayload, DocumentId, ToastType}; +use crate::state::jobs::JobKind; +use crate::state::rpf9_scan::{Ended, Row}; +use crate::state::{AppState, DocPayload, DocumentId, ToastType}; -pub(super) fn le32(v: u32) -> [u8; 4] { +pub(in crate::state) fn le32(v: u32) -> [u8; 4] { v.to_le_bytes() } /// An RPF9 head of layout 4 that holds every measured rule, and its table, `toc_end` bytes in /// all; parts A to C take the first 0x190. -pub(super) fn rpf9_head(entries: u32, toc_end: u32) -> Vec { +pub(in crate::state) fn rpf9_head(entries: u32, toc_end: u32) -> Vec { let mut bytes = vec![0x5Au8; toc_end as usize]; bytes[..0x40].fill(0); bytes[..4].copy_from_slice(b"9FPR"); @@ -32,7 +32,7 @@ pub(super) fn rpf9_head(entries: u32, toc_end: u32) -> Vec { } /// `data` as a zlib stream of one stored deflate block, under the `78 DA` head a scan looks for. -pub(super) fn zlib(data: &[u8]) -> Vec { +pub(in crate::state) fn zlib(data: &[u8]) -> Vec { let len = u16::try_from(data.len()).expect("one stored block"); let mut out = vec![0x78, 0xDA, 0x01]; out.extend(len.to_le_bytes()); @@ -72,7 +72,7 @@ fn member() -> [u8; 16] { /// The virtual section of a headerless RBM resource whose root holds one u32 in the block at /// `block`: 0x5 addresses the virtual section, 0x6 the physical. -pub(super) fn headerless_rbm(block: u64) -> Vec { +pub(in crate::state) fn headerless_rbm(block: u64) -> Vec { const VIRTUAL: u64 = 0x5000_0000; let mut v = vec![0u8; 0x100]; let mut put = |at: usize, bytes: &[u8]| v[at..at + bytes.len()].copy_from_slice(bytes); @@ -95,12 +95,12 @@ pub(super) fn headerless_rbm(block: u64) -> Vec { v } -pub(super) const CHANGE_SET: &[u8] = +pub(in crate::state) const CHANGE_SET: &[u8] = b"\n\ ccs_testa.rpfRPF_FILE\ \n"; -pub(super) fn written(dir: &Path, bytes: &[u8]) -> PathBuf { +pub(in crate::state) fn written(dir: &Path, bytes: &[u8]) -> PathBuf { let path = dir.join("data.rpf"); std::fs::write(&path, bytes).expect("written"); path @@ -113,7 +113,7 @@ fn load(state: &mut AppState, path: PathBuf) { } /// Wait for the loads in flight to end. -pub(super) fn settle(state: &mut AppState) { +pub(in crate::state) fn settle(state: &mut AppState) { let deadline = Instant::now() + Duration::from_secs(30); while state.load_receiver.is_some() || !state.pending_loads.is_empty() { state.poll_load_result(); @@ -123,7 +123,7 @@ pub(super) fn settle(state: &mut AppState) { } /// Open the archive and wait for its scan to end. -pub(super) fn scanned(state: &mut AppState, path: PathBuf) -> DocumentId { +pub(in crate::state) fn scanned(state: &mut AppState, path: PathBuf) -> DocumentId { load(state, path); let doc = (state.active_document) .unwrap_or_else(|| panic!("the archive did not open: {}", state.error_dialog_message)); @@ -141,7 +141,7 @@ pub(super) fn scanned(state: &mut AppState, path: PathBuf) -> DocumentId { doc } -pub(super) fn rows(state: &AppState, doc: DocumentId) -> Vec { +pub(in crate::state) fn rows(state: &AppState, doc: DocumentId) -> Vec { match state.document(doc).map(|d| &d.payload) { Some(DocPayload::Rpf9(scan)) => scan.found().rows.clone(), _ => panic!("not a GTA VI archive document"), @@ -149,13 +149,13 @@ pub(super) fn rows(state: &AppState, doc: DocumentId) -> Vec { } /// The row of the top-level body at `offset`. -pub(super) fn row_at(rows: &[Row], offset: u64) -> usize { +pub(in crate::state) fn row_at(rows: &[Row], offset: u64) -> usize { rows.iter() .position(|r| matches!(r, Row::Body(f) if f.offset == offset && f.container.is_none())) .unwrap_or_else(|| panic!("no body at {offset:#X} in {rows:?}")) } -pub(super) fn said(state: &AppState, kind: ToastType, words: &[&str]) -> bool { +pub(in crate::state) fn said(state: &AppState, kind: ToastType, words: &[&str]) -> bool { (state.toasts.iter()) .filter(|t| t.toast_type == kind) .any(|t| words.iter().all(|w| t.message.contains(w))) @@ -241,7 +241,7 @@ fn an_archive_whose_head_is_zero_is_not_called_a_gta_vi_archive() { } /// The virtual section of a GTA VI navigation mesh of one water triangle over a 128 m cell. -pub(super) fn navmesh_cell() -> Vec { +pub(in crate::state) fn navmesh_cell() -> Vec { let mut v = vec![0u8; 0x360]; let put = |v: &mut Vec, at: usize, bytes: &[u8]| v[at..at + bytes.len()].copy_from_slice(bytes); @@ -315,7 +315,7 @@ pub(super) fn navmesh_cell() -> Vec { } /// The Files panel beside the centre, as Browse lays them out: the scan's list, then the archive's facts. -pub(super) fn files_and_centre(ui: &mut egui::Ui, state: &mut AppState) { +pub(in crate::state) fn files_and_centre(ui: &mut egui::Ui, state: &mut AppState) { egui::Panel::left("files") .resizable(false) .exact_size(560.0) @@ -339,8 +339,10 @@ fn a_body_of_a_gta_vi_archive_is_of_no_gta_v_edition_and_does_not_convert() { .filter(|&d| d != archive) .expect("the body opens"); let path = state.document(doc).and_then(|d| d.path.clone()); - assert!(super::rpf9_scan::from_gta_vi(path.as_deref())); + assert!(crate::state::rpf9_scan::from_gta_vi(path.as_deref())); let refused = state.document_conversion_to(doc).unwrap_err(); assert!(refused.contains("neither GTA V edition"), "{refused}"); - assert!(!super::rpf9_scan::from_gta_vi(Some(Path::new("loose.ytd")))); + assert!(!crate::state::rpf9_scan::from_gta_vi(Some(Path::new( + "loose.ytd" + )))); } diff --git a/src/state/opening_an_unknown_file.rs b/src/state/tests/opening_an_unknown_file.rs similarity index 96% rename from src/state/opening_an_unknown_file.rs rename to src/state/tests/opening_an_unknown_file.rs index 81083148d..e878d208a 100644 --- a/src/state/opening_an_unknown_file.rs +++ b/src/state/tests/opening_an_unknown_file.rs @@ -4,7 +4,7 @@ use std::path::PathBuf; use std::time::{Duration, Instant}; -use super::{AppState, DocPayload, DocumentId, DocumentKind, HexDocument, LoadingState}; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind, HexDocument, LoadingState}; fn wait(state: &mut AppState, what: &str) { let deadline = Instant::now() + Duration::from_secs(30); @@ -64,13 +64,13 @@ fn a_binary_dat_with_no_reader_opens_as_hex_under_its_refusal() { fn an_archive_entry_no_reader_opens_opens_as_hex() { let dir = tempfile::tempdir().expect("a scratch directory"); let mut state = AppState::new(); - let archive = super::document_io::serialize_archive_records( + let archive = crate::state::document_io::serialize_archive_records( vec![( "data/probe.zzunknown".to_string(), BINARY_TABLE.to_vec(), false, )], - super::RpfOutputMode::Open, + crate::state::RpfOutputMode::Open, state.keys.provider(), ) .expect("archive bytes"); diff --git a/src/state/opening_metadata_without_a_schema.rs b/src/state/tests/opening_metadata_without_a_schema.rs similarity index 98% rename from src/state/opening_metadata_without_a_schema.rs rename to src/state/tests/opening_metadata_without_a_schema.rs index b5d3de070..252cfd875 100644 --- a/src/state/opening_metadata_without_a_schema.rs +++ b/src/state/tests/opening_metadata_without_a_schema.rs @@ -11,8 +11,8 @@ use or_io::meta::Value; use or_test_support::{game_roots, skip_install, GAME_ROOT_ENV}; use super::opening_a_ydd::{finish_load, node_at, with_keys}; -use super::{AppState, DocPayload, DocumentId, DocumentKind}; use crate::state::Workspace; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind}; const IMAGES_META: &str = "common.rpf/data/levels/gta5/images.meta"; const WEATHER_XML: &str = "common.rpf/data/levels/gta5/weather.xml"; diff --git a/src/state/opening_world_dat.rs b/src/state/tests/opening_world_dat.rs similarity index 96% rename from src/state/opening_world_dat.rs rename to src/state/tests/opening_world_dat.rs index 3bcc5c8ee..b679c1622 100644 --- a/src/state/opening_world_dat.rs +++ b/src/state/tests/opening_world_dat.rs @@ -14,7 +14,7 @@ use std::time::{Duration, Instant}; use or_io::distant_lights::{DistantLightGroup, DistantLightPoint, DistantLights, BLOCKS_HD}; use or_io::height_map::HeightMap; -use super::{AppState, DocPayload, DocumentId, DocumentKind, LoadingState}; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind, LoadingState}; fn height_map() -> Vec { HeightMap { @@ -108,13 +108,13 @@ fn distant_lights_open_from_an_archive_and_from_disk_and_save_their_bytes() { let root = dir.path().join("install"); std::fs::create_dir_all(&root).expect("the install root"); - let archive = super::document_io::serialize_archive_records( + let archive = crate::state::document_io::serialize_archive_records( vec![( "data/levels/gta5/distantlights_hd.dat".to_string(), bytes.clone(), false, )], - super::RpfOutputMode::Open, + crate::state::RpfOutputMode::Open, state.keys.provider(), ) .expect("archive bytes"); diff --git a/src/state/opus_on_a_worker.rs b/src/state/tests/opus_on_a_worker.rs similarity index 98% rename from src/state/opus_on_a_worker.rs rename to src/state/tests/opus_on_a_worker.rs index d74296946..bf251ce0c 100644 --- a/src/state/opus_on_a_worker.rs +++ b/src/state/tests/opus_on_a_worker.rs @@ -9,10 +9,10 @@ use std::time::{Duration, Instant}; use or_io::awc::wav::wav_from_pcm16; use or_io::awc::{AwcFile, AwcKey}; -use super::jobs::{JobKind, Outcome}; use super::opening_a_gta_vi_awc::{gta_vi, opus_packets, opus_single}; use super::opening_an_awc::{opened, ramp}; -use super::AppState; +use crate::state::jobs::{JobKind, Outcome}; +use crate::state::AppState; /// Waits out the Opus job, then polls the jobs once, which says how it ended. fn worked(state: &mut AppState) { diff --git a/src/state/previewing_a_video.rs b/src/state/tests/previewing_a_video.rs similarity index 99% rename from src/state/previewing_a_video.rs rename to src/state/tests/previewing_a_video.rs index ed8ced399..d15fbebe5 100644 --- a/src/state/previewing_a_video.rs +++ b/src/state/tests/previewing_a_video.rs @@ -15,8 +15,8 @@ use or_io::container::rpf::RpfArchive; use or_test_support::{game_roots, skip_install, GAME_ROOT_ENV}; use or_title::game::Game; -use super::{AppState, DocPayload, DocumentId, DocumentKind, LoadingState}; use crate::audio::{AudioOut, NullSink}; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind, LoadingState}; #[cfg(windows)] use crate::video::bink; use crate::video::{PREVIEW_HEIGHT, PREVIEW_WIDTH, ROUTE}; diff --git a/src/state/reopening_a_built_pack_from_the_app.rs b/src/state/tests/reopening_a_built_pack_from_the_app.rs similarity index 98% rename from src/state/reopening_a_built_pack_from_the_app.rs rename to src/state/tests/reopening_a_built_pack_from_the_app.rs index 6ab900b75..df524fa46 100644 --- a/src/state/reopening_a_built_pack_from_the_app.rs +++ b/src/state/tests/reopening_a_built_pack_from_the_app.rs @@ -12,10 +12,10 @@ use or_project::{ use or_wardrobe::edit::Watch; use super::importing_game_files_from_the_app::until; -use super::jobs::{JobKind, Outcome, Then}; -use super::os_drop::{plan, DropAction, DropTarget}; -use super::workbench::{destination, Question}; -use super::{AppState, Prefs}; +use crate::state::jobs::{JobKind, Outcome, Then}; +use crate::state::os_drop::{plan, DropAction, DropTarget}; +use crate::state::workbench::{destination, Question}; +use crate::state::{AppState, Prefs}; const HANDLING: &[u8] = b"\n\n"; diff --git a/src/state/reordering_mods_from_the_app.rs b/src/state/tests/reordering_mods_from_the_app.rs similarity index 96% rename from src/state/reordering_mods_from_the_app.rs rename to src/state/tests/reordering_mods_from_the_app.rs index e115b7c4d..13e02f55a 100644 --- a/src/state/reordering_mods_from_the_app.rs +++ b/src/state/tests/reordering_mods_from_the_app.rs @@ -3,10 +3,10 @@ use std::path::Path; -use super::mod_manager::PendingModMove; use super::nested_archives_survive_a_save::errors; -use super::prefs::{load_prefs_from, save_prefs_to}; -use super::{AppState, EditMode, Game}; +use crate::state::mod_manager::PendingModMove; +use crate::state::prefs::{load_prefs_from, save_prefs_to}; +use crate::state::{AppState, EditMode, Game}; const SHARED: &str = "x64a.rpf/levels/gta5/props.ydr"; diff --git a/src/state/replacing_geometry_from_the_app.rs b/src/state/tests/replacing_geometry_from_the_app.rs similarity index 98% rename from src/state/replacing_geometry_from_the_app.rs rename to src/state/tests/replacing_geometry_from_the_app.rs index b7c2d7f08..fcf144a08 100644 --- a/src/state/replacing_geometry_from_the_app.rs +++ b/src/state/tests/replacing_geometry_from_the_app.rs @@ -15,10 +15,10 @@ use or_test_support::{skip_corpus, Corpus, TARGET_GEN8}; use super::importing_game_files_from_the_app::{imported, project, row, until}; use super::opening_a_ydd::finish_load; -use super::workbench::{AssetState, Question}; -use super::AppState; use crate::render::meshes::build_meshes_for_active_document; use crate::render::viewport::MeshCacheKey; +use crate::state::workbench::{AssetState, Question}; +use crate::state::AppState; use crate::state::Workspace; const MANIFEST: &str = env!("CARGO_MANIFEST_DIR"); diff --git a/src/state/saving_twice_and_into_an_archive_not_yet_opened.rs b/src/state/tests/saving_twice_and_into_an_archive_not_yet_opened.rs similarity index 99% rename from src/state/saving_twice_and_into_an_archive_not_yet_opened.rs rename to src/state/tests/saving_twice_and_into_an_archive_not_yet_opened.rs index f8988bc7f..c8bb70703 100644 --- a/src/state/saving_twice_and_into_an_archive_not_yet_opened.rs +++ b/src/state/tests/saving_twice_and_into_an_archive_not_yet_opened.rs @@ -10,7 +10,7 @@ use super::nested_archives_survive_a_save::{ archive, body, errors, nested, on_disk, open, save, Opened, EDITED, }; use super::opening_a_ydd::node_at; -use super::AppState; +use crate::state::AppState; /// Every file of `archive` and of each archive nested in it, decoded, by path. fn contents(archive: &Arc) -> Vec<(String, Vec)> { diff --git a/src/state/search_results_that_open.rs b/src/state/tests/search_results_that_open.rs similarity index 97% rename from src/state/search_results_that_open.rs rename to src/state/tests/search_results_that_open.rs index 5a7a813fa..99f4d3c49 100644 --- a/src/state/search_results_that_open.rs +++ b/src/state/tests/search_results_that_open.rs @@ -12,13 +12,13 @@ use std::time::{Duration, Instant}; use or_io::container::rpf::BodyForm; use or_io::container::NoOpCryptoProvider; -use super::document::{DocumentId, RpfNodeId}; -use super::extract_job::TypeFilter; -use super::navigation::{resolve_path, Arrival, Resolved}; use super::nested_archives_survive_a_save::archive; -use super::search_session::{SearchMode, SearchRequest}; -use super::{AppState, DocPayload, DocumentKind, Game, Prefs}; +use crate::state::document::{DocumentId, RpfNodeId}; +use crate::state::extract_job::TypeFilter; +use crate::state::navigation::{resolve_path, Arrival, Resolved}; +use crate::state::search_session::{SearchMode, SearchRequest}; use crate::state::Workspace; +use crate::state::{AppState, DocPayload, DocumentKind, Game, Prefs}; use crate::ui::panels::search::RESULTS; const NONE: egui::Modifiers = egui::Modifiers::NONE; diff --git a/src/state/settings_recents_and_small_editor_fixes.rs b/src/state/tests/settings_recents_and_small_editor_fixes.rs similarity index 96% rename from src/state/settings_recents_and_small_editor_fixes.rs rename to src/state/tests/settings_recents_and_small_editor_fixes.rs index ba04a5794..182c300b1 100644 --- a/src/state/settings_recents_and_small_editor_fixes.rs +++ b/src/state/tests/settings_recents_and_small_editor_fixes.rs @@ -5,8 +5,8 @@ use std::path::Path; -use super::prefs::{Game, Prefs}; -use super::{ +use crate::state::prefs::{Game, Prefs}; +use crate::state::{ AppState, CloseAnswer, DocPayload, DocumentId, DocumentKind, RpfEntryBinding, TextDocument, }; use crate::ui::commands::{self, Action}; @@ -88,9 +88,9 @@ type Ask = Box; /// Each question the shell can ask, by name, with what leaves it waiting. fn questions() -> Vec<(&'static str, Ask)> { - use super::delete_prompt::{DeleteFrom, PendingDelete}; - use super::extract_job::{ExtractClash, PendingExportFixes, TypeFilter}; - use super::{PendingEnhancedOpen, PendingRetailEdit, PendingRetailEditPrompt}; + use crate::state::delete_prompt::{DeleteFrom, PendingDelete}; + use crate::state::extract_job::{ExtractClash, PendingExportFixes, TypeFilter}; + use crate::state::{PendingEnhancedOpen, PendingRetailEdit, PendingRetailEditPrompt}; vec![ ( diff --git a/src/state/shards.rs b/src/state/tests/shards.rs similarity index 100% rename from src/state/shards.rs rename to src/state/tests/shards.rs diff --git a/src/state/sharing_a_project.rs b/src/state/tests/sharing_a_project.rs similarity index 98% rename from src/state/sharing_a_project.rs rename to src/state/tests/sharing_a_project.rs index 7491bddad..6f70e6741 100644 --- a/src/state/sharing_a_project.rs +++ b/src/state/tests/sharing_a_project.rs @@ -7,7 +7,7 @@ use std::path::Path; use or_source::git; -use super::front_door::{NewProject, Template}; +use crate::state::front_door::{NewProject, Template}; fn read(path: &Path) -> String { std::fs::read_to_string(path).unwrap_or_default() @@ -91,9 +91,9 @@ mod the_check { imported, project, project_and_install, until, write, }; use super::super::opening_a_ydd::node_at; - use super::super::workbench::{Concern, ConcernKind, Question}; - use super::super::{AppState, Prefs}; use super::*; + use crate::state::workbench::{Concern, ConcernKind, Question}; + use crate::state::{AppState, Prefs}; fn asked(state: &AppState) -> Vec { match &state.workbench.asking { @@ -346,8 +346,8 @@ mod the_zip { use std::path::PathBuf; use super::super::importing_game_files_from_the_app::{imported, until, write, ytd}; - use super::super::{AppState, Prefs}; use super::*; + use crate::state::{AppState, Prefs}; const C: &str = "mp_m_freemode_01_mp_m_t"; diff --git a/src/state/small_faults_in_the_default_views_menus_and_keys.rs b/src/state/tests/small_faults_in_the_default_views_menus_and_keys.rs similarity index 97% rename from src/state/small_faults_in_the_default_views_menus_and_keys.rs rename to src/state/tests/small_faults_in_the_default_views_menus_and_keys.rs index 98fdd4330..ed125a224 100644 --- a/src/state/small_faults_in_the_default_views_menus_and_keys.rs +++ b/src/state/tests/small_faults_in_the_default_views_menus_and_keys.rs @@ -13,8 +13,8 @@ use super::the_files_view_in_the_centre::{ accessible, browsing, click, click_with, find, frame, leaf_of, run, settled, }; use super::the_inspector_leads_with_a_summary::drawn_by; -use super::{AppState, DocumentId, Prefs}; use crate::state::panel_ids as ids; +use crate::state::{AppState, DocumentId, Prefs}; /// `name`'s row in the Files tree, which has its icon before the name, right-clicked, and the menu it opens. fn documents_own_menu( @@ -323,7 +323,7 @@ fn a_tab_menu_closes_when_a_load_leaves_the_document_it_belonged_to() { fn a_drawable_of_one_model(state: &mut AppState) -> DocumentId { let doc = super::every_edit_undoes::drawable(state, "probe.ydr"); let document = state.document_mut(doc).expect("open"); - let drawable = super::drawable_mut(&mut document.payload, 0).expect("a Legacy drawable"); + let drawable = crate::state::drawable_mut(&mut document.payload, 0).expect("a Legacy drawable"); drawable.lod_group.lods[0].models.push(Box::new( or_io::gta5::GrmModel::::default(), )); @@ -383,7 +383,7 @@ fn a_particle_models_geometry_selected(state: &mut AppState) -> DocumentId { })); let doc = state.insert_document( PathBuf::from("probe.ypt"), - super::DocPayload::Resource(or_io::Asset::Particles(list)), + crate::state::DocPayload::Resource(or_io::Asset::Particles(list)), None, None, ); @@ -425,7 +425,7 @@ fn a_particle_models_geometry_states_its_index_count_once() { } /// A Legacy or Enhanced texture dictionary of one texture, active in its workspace. -fn a_dictionary_of_one_texture(state: &mut AppState, enhanced: bool) -> super::DocPayload { +fn a_dictionary_of_one_texture(state: &mut AppState, enhanced: bool) -> crate::state::DocPayload { use or_io::decl::Open; use or_io::gta5::{gen8, gen9, PgDictionary}; @@ -452,7 +452,7 @@ fn a_dictionary_of_one_texture(state: &mut AppState, enhanced: bool) -> super::D }); or_io::Asset::TextureDict(dictionary) }; - let payload = super::DocPayload::Resource(asset); + let payload = crate::state::DocPayload::Resource(asset); let doc = state.insert_document(PathBuf::from("probe.ytd"), payload.clone(), None, None); state.active_workspace = state.document(doc).expect("open").kind().info().workspace; payload @@ -472,7 +472,7 @@ fn a_dictionary_of_one_texture_says_1_texture_in_its_outline_and_its_summary() { .map(|(_, text)| text) .filter(|text| text.contains("texture")) .collect(); - let summary = super::capabilities::for_payload(&payload) + let summary = crate::state::capabilities::for_payload(&payload) .and_then(|row| row.selection_summary) .map_or_else(String::new, |summary| { summary(&payload, crate::state::SelectionKey::DocRoot) diff --git a/src/state/small_faults_in_the_editor_and_the_previews.rs b/src/state/tests/small_faults_in_the_editor_and_the_previews.rs similarity index 99% rename from src/state/small_faults_in_the_editor_and_the_previews.rs rename to src/state/tests/small_faults_in_the_editor_and_the_previews.rs index 8ba827257..c23fc87b3 100644 --- a/src/state/small_faults_in_the_editor_and_the_previews.rs +++ b/src/state/tests/small_faults_in_the_editor_and_the_previews.rs @@ -13,8 +13,8 @@ use super::nothing_draws_over_what_it_belongs_to::{ a_texture_on_screen, app_context, areas_over_the_panels, default_and_narrow, draw_editor, editing, input, lines_and_the_rest, long_lines, painted, widgets, window, within, Panel, }; -use super::{AppState, DocPayload, Document, DocumentId, Prefs}; use crate::state::Workspace; +use crate::state::{AppState, DocPayload, Document, DocumentId, Prefs}; use crate::ui::dock::Tab; use crate::ui::panels::text_editor::editor_state::FIND_DEBOUNCE; diff --git a/src/state/tabs_that_behave_like_an_editors.rs b/src/state/tests/tabs_that_behave_like_an_editors.rs similarity index 98% rename from src/state/tabs_that_behave_like_an_editors.rs rename to src/state/tests/tabs_that_behave_like_an_editors.rs index 414af7568..1bb624c27 100644 --- a/src/state/tabs_that_behave_like_an_editors.rs +++ b/src/state/tests/tabs_that_behave_like_an_editors.rs @@ -8,13 +8,13 @@ use std::time::{Duration, Instant}; use winit::keyboard::{Key, KeyCode, ModifiersState, NamedKey, PhysicalKey}; -use super::document::{DocumentId, RpfNodeId, TextDocument}; -use super::navigation::Arrival; use super::nested_archives_survive_a_save::archive; use super::opening_a_ydd::{finish_load, node_at}; use super::two_readers_of_one_archive_across_a_save::install; -use super::{AppState, DocPayload, DocumentKind, Prefs}; +use crate::state::document::{DocumentId, RpfNodeId, TextDocument}; +use crate::state::navigation::Arrival; use crate::state::Workspace; +use crate::state::{AppState, DocPayload, DocumentKind, Prefs}; use crate::ui::{commands, shortcuts}; /// The tab strip and Files, drawn as the editor draws them, on a screen of its own. @@ -312,7 +312,7 @@ fn every_tab_has_a_close_button_and_those_that_do_not_fit_are_in_a_list() { state.document(only).is_some() && state.pending_close.is_some(), "the close button dropped unsaved work without asking" ); - state.answer_close(super::CloseAnswer::DontSave); + state.answer_close(crate::state::CloseAnswer::DontSave); assert!(state.document(only).is_none()); let docs: Vec = (0..30) diff --git a/src/state/test_scratch.rs b/src/state/tests/test_scratch.rs similarity index 97% rename from src/state/test_scratch.rs rename to src/state/tests/test_scratch.rs index 8784de45e..5d4563c37 100644 --- a/src/state/test_scratch.rs +++ b/src/state/tests/test_scratch.rs @@ -5,14 +5,14 @@ use std::path::PathBuf; use std::process::{Command, Output}; use std::sync::OnceLock; -use super::config_root; +use crate::state::config_root; static ROOT: OnceLock> = OnceLock::new(); /// Where `config_root` is in a test build: one folder for the process, removed when it ends. /// /// ⚠ Not a `TempDir` held in a static: a static is never dropped, so that left its folder behind. -pub(super) fn root() -> Option { +pub(in crate::state) fn root() -> Option { ROOT.get_or_init(|| { let root = tempfile::Builder::new() .prefix("openrage-test-") @@ -141,7 +141,7 @@ fn a_test_process_leaves_no_folder_in_the_temporary_folder_when_it_ends() { let module = module_path!().split_once("::").map_or("", |(_, rest)| rest); let tests = [ format!("{module}::the_scratch_configuration_is_a_folder_of_the_temporary_folder"), - "state::a_plugin_asks_before_it_runs::the_sample_guest_shows_what_it_declared_before_it_runs" + "state::tests::a_plugin_asks_before_it_runs::the_sample_guest_shows_what_it_declared_before_it_runs" .to_string(), ]; let (ran, left) = run_with_a_temporary_folder_of_its_own(&tests, &[]); diff --git a/src/state/the_addon_ped_in_the_app.rs b/src/state/tests/the_addon_ped_in_the_app.rs similarity index 97% rename from src/state/the_addon_ped_in_the_app.rs rename to src/state/tests/the_addon_ped_in_the_app.rs index 6f0c48280..7b4ead5e8 100644 --- a/src/state/the_addon_ped_in_the_app.rs +++ b/src/state/tests/the_addon_ped_in_the_app.rs @@ -10,9 +10,9 @@ use std::time::{Duration, Instant}; use or_addonped::{AddonPeds, Ped, PedFile}; use or_project::{Container, Module, ModuleKind, Output, Project}; -use super::front_door::cards::read_card; -use super::front_door::{NewProject, Template}; -use super::{AppState, Prefs}; +use crate::state::front_door::cards::read_card; +use crate::state::front_door::{NewProject, Template}; +use crate::state::{AppState, Prefs}; /// The bytes of a ped's model and of its textures. struct Staged { diff --git a/src/state/the_animation_preview_draws_what_its_sources_hold.rs b/src/state/tests/the_animation_preview_draws_what_its_sources_hold.rs similarity index 98% rename from src/state/the_animation_preview_draws_what_its_sources_hold.rs rename to src/state/tests/the_animation_preview_draws_what_its_sources_hold.rs index 800e4e4f0..72961acc8 100644 --- a/src/state/the_animation_preview_draws_what_its_sources_hold.rs +++ b/src/state/tests/the_animation_preview_draws_what_its_sources_hold.rs @@ -18,16 +18,16 @@ use or_transport::TimeRange; use super::an_edit_stays_where_it_was_made::open; use super::opening_a_ydd::finish_load; -use super::texture_resolution::{report, resolve, ResolutionRule}; -use super::textures::{textures_in, TextureListing}; -use super::{AppState, DocPayload, DocumentId, Game, MeshSource, SkeletonSource}; use crate::render::meshes::build_meshes_for_active_document; use crate::render::viewport::{bound_texture, MeshCacheKey}; +use crate::state::texture_resolution::{report, resolve, ResolutionRule}; +use crate::state::textures::{textures_in, TextureListing}; use crate::state::Workspace; +use crate::state::{AppState, DocPayload, DocumentId, Game, MeshSource, SkeletonSource}; -pub(super) const CLIP: u32 = 0x1234; -pub(super) const OTHER_CLIP: u32 = 0x1235; -pub(super) const ANIMATION: u32 = 0x1000; +pub(in crate::state) const CLIP: u32 = 0x1234; +pub(in crate::state) const OTHER_CLIP: u32 = 0x1235; +pub(in crate::state) const ANIMATION: u32 = 0x1000; /// The bone tags of [`rigged`], root first. const TAGS: [u16; 2] = [100, 200]; const TARGETS: [(&str, Game); 2] = [ @@ -50,7 +50,7 @@ where } /// A dictionary of two clips, [`CLIP`] and [`OTHER_CLIP`], that rotate the bones of [`TAGS`]. -pub(super) fn a_clip_over_the_rig() -> CrClipDictionary { +pub(in crate::state) fn a_clip_over_the_rig() -> CrClipDictionary { let dofs = TAGS .iter() .map(|tag| Dof { @@ -95,7 +95,7 @@ pub(super) fn a_clip_over_the_rig() -> CrClipDictionary { /// A drawable of target `T` whose skeleton has a bone for each of [`TAGS`], each a metre above its parent. // The struct update the lint asks for does not compile: the drawable holds private fields. #[allow(clippy::field_reassign_with_default)] -pub(super) fn rigged() -> GtaDrawable { +pub(in crate::state) fn rigged() -> GtaDrawable { let bone = |index: usize| CrBoneData { rotation: Vec4V { w: 1.0, @@ -173,7 +173,7 @@ fn bone_x(state: &AppState, doc: DocumentId, bone: usize) -> (String, or_editor: let doc = state.document(doc).expect("open"); let outline = crate::ui::panels::hierarchy::described_outline(doc).expect("an outline"); let node = find(&outline.root, bone).expect("the bone is in the outline"); - let (pack, _) = super::described_root(doc).expect("a drawable is described"); + let (pack, _) = crate::state::described_root(doc).expect("a drawable is described"); let image = doc.resource.as_ref().expect("the image it was read from"); let (type_name, at) = (node.type_name.as_deref().expect("typed"), node.at); let summary = or_editor::Summary::of(&pack, type_name, image.view(), at).expect("a summary"); diff --git a/src/state/the_animation_preview_follows_its_sources.rs b/src/state/tests/the_animation_preview_follows_its_sources.rs similarity index 94% rename from src/state/the_animation_preview_follows_its_sources.rs rename to src/state/tests/the_animation_preview_follows_its_sources.rs index 4f2dfae00..c8b0f2aa2 100644 --- a/src/state/the_animation_preview_follows_its_sources.rs +++ b/src/state/tests/the_animation_preview_follows_its_sources.rs @@ -8,9 +8,9 @@ use std::path::PathBuf; use or_io::decl::Gen8; use or_io::gta5::CrClipDictionary; -use super::prefs::Prefs; use super::the_animation_preview_draws_what_its_sources_hold::{a_clip_over_the_rig, rigged, CLIP}; -use super::{AppState, DocPayload, DocumentId, MeshSource, SkeletonSource}; +use crate::state::prefs::Prefs; +use crate::state::{AppState, DocPayload, DocumentId, MeshSource, SkeletonSource}; fn open(state: &mut AppState, path: &str, payload: DocPayload) -> DocumentId { state.insert_document(PathBuf::from(path), payload, None, None) diff --git a/src/state/the_default_views_in_a_modders_words.rs b/src/state/tests/the_default_views_in_a_modders_words.rs similarity index 96% rename from src/state/the_default_views_in_a_modders_words.rs rename to src/state/tests/the_default_views_in_a_modders_words.rs index 44412d1a2..ad00cc515 100644 --- a/src/state/the_default_views_in_a_modders_words.rs +++ b/src/state/tests/the_default_views_in_a_modders_words.rs @@ -15,9 +15,9 @@ use super::an_edit_stays_where_it_was_made::Inspector; use super::every_edit_undoes::drawable; use super::nested_archives_survive_a_save::archive; use super::opening_a_ydd::{finish_load, node_at}; -use super::prefs::{keep_prefs_in, load_prefs, Game, Prefs}; use super::the_inspector_leads_with_a_summary::{drawn_by, leaf, other_spellings}; -use super::{AppState, CloseAnswer, DictPart, DocumentId, SelectionKey}; +use crate::state::prefs::{keep_prefs_in, load_prefs, Game, Prefs}; +use crate::state::{AppState, CloseAnswer, DictPart, DocumentId, SelectionKey}; use crate::ui::panels::inspector::summary_at; const WHAT: &str = "the default view of every corpus kind"; @@ -85,7 +85,7 @@ fn geometry_selections(state: &AppState, id: DocumentId) -> Vec { let Some(doc) = state.document(id) else { return Vec::new(); }; - let super::DocPayload::Resource(asset) = &doc.payload else { + let crate::state::DocPayload::Resource(asset) = &doc.payload else { return Vec::new(); }; let lod = |(lod, model, geom)| DictPart::Lod { @@ -190,7 +190,7 @@ fn grid_of(state: &AppState, id: DocumentId, selection: &Selection) -> Option { - let (_, root) = super::described_root(doc)?; + let (_, root) = crate::state::described_root(doc)?; summary_at(doc, &root, 0) } Selection::Described(path) => { @@ -234,7 +234,7 @@ fn found_in(state: &mut AppState, path: &Path) -> Result, String> { let kind = state.document(id).map(|d| d.kind()).ok_or("no document")?; let declared = Declared::of(state, id); let schema_path = match state.document(id).map(|d| &d.payload) { - Some(super::DocPayload::Meta(meta)) => crate::state::meta_schema() + Some(crate::state::DocPayload::Meta(meta)) => crate::state::meta_schema() .struct_any(meta.type_name()) .map(|s| s.source_path.clone()) .unwrap_or_default(), @@ -261,7 +261,7 @@ fn found_in(state: &mut AppState, path: &Path) -> Result, String> { Selection::Legacy(sel) => state.selection.select(id, *sel), } let mut shown = inspected(state); - if kind == super::DocumentKind::Meta { + if kind == crate::state::DocumentKind::Meta { shown.extend(drawn_by(state, |ui, state| { crate::ui::panels::meta_editor::draw(ui, state) })); @@ -468,7 +468,7 @@ mod every_corpus_kind_states_no_row_twice_counts_one_model_in_the_singular_and_n /// The label of a row the declared grid keeps behind Show internals, in a described drawable. fn an_internal_label(state: &AppState, doc: DocumentId) -> String { let doc = state.document(doc).expect("open"); - let (_, root) = super::described_root(doc).expect("a drawable is described"); + let (_, root) = crate::state::described_root(doc).expect("a drawable is described"); let rows = summary_at(doc, &root, 0).expect("a summary").rows; (rows.into_iter()) .find(|r| r.internal && !r.label.is_empty()) @@ -548,14 +548,15 @@ fn an_archive_on_disk_not_yet_opened_shows_its_size_in_its_inspector() { let (state, shown) = inspected_row(&[("outer.rpf", &bytes)], "outer.rpf"); let folder = state.active_document.expect("the folder"); - let Some(super::DocPayload::Rpf(rpf)) = state.document(folder).map(|d| &d.payload) else { + let Some(crate::state::DocPayload::Rpf(rpf)) = state.document(folder).map(|d| &d.payload) + else { panic!("the folder is a tree"); }; let row = rpf.session.children_of(rpf.session.root_id())[0]; assert!( matches!( rpf.session.node(row).map(|n| &n.backing), - Some(super::RpfNodeBacking::Archive { scanned: false, .. }) + Some(crate::state::RpfNodeBacking::Archive { scanned: false, .. }) ), "the archive was opened by selecting it" ); @@ -618,7 +619,7 @@ fn a_clip_dictionarys_facts_under_show_internals_do_not_repeat_rows_of_its_grid( let shown = inspector_words(&mut state); let doc = state.document(id).expect("open"); - let (_, root) = super::described_root(doc).expect("a clip dictionary is described"); + let (_, root) = crate::state::described_root(doc).expect("a clip dictionary is described"); let rows = summary_at(doc, &root, 0).expect("a summary").rows; let gridded = |name: &str| { let squashed = |text: &str| text.to_ascii_lowercase().replace('_', ""); @@ -653,14 +654,14 @@ fn drawable_at(state: &mut AppState, version: u32) -> DocumentId { ); let seal = Rsc7::invent_single_chunk_seal(version, 0x4000).expect("a seal"); let data = vec![0; seal.total_size() as usize]; - let image = super::ResourceImage { + let image = crate::state::ResourceImage { virtual_size: data.len(), data, seal, }; let id = state.alloc_doc_id(); - let payload = super::DocPayload::Resource(or_io::Asset::Drawable(Default::default())); - let doc = super::Document::new(id, Some("probe.ydr".into()), payload) + let payload = crate::state::DocPayload::Resource(or_io::Asset::Drawable(Default::default())); + let doc = crate::state::Document::new(id, Some("probe.ydr".into()), payload) .with_resource(Some(std::sync::Arc::new(image))); state.documents.push(doc); state.active_document = Some(id); @@ -686,10 +687,10 @@ fn edition(state: &mut AppState) -> String { /// An edit of `doc`'s drawable contents, as an editor of them makes one, sealed as the shell does. fn edit_the_contents(state: &mut AppState, doc: DocumentId, distance: f32) { let document = state.document_mut(doc).expect("open"); - let drawable = super::drawable_mut(&mut document.payload, 0).expect("a Legacy drawable"); + let drawable = crate::state::drawable_mut(&mut document.payload, 0).expect("a Legacy drawable"); let was = std::mem::replace(&mut drawable.lod_group.lod_distances[1], distance); - let change = super::Change::part("distance 1", was, |p| { - super::drawable_mut(p, 0)? + let change = crate::state::Change::part("distance 1", was, |p| { + crate::state::drawable_mut(p, 0)? .lod_group .lod_distances .get_mut(1) @@ -790,7 +791,7 @@ fn a_metadata_files_format_code_shows_under_show_internals_and_not_before() { continue; }; let code = match state.document(id).map(|d| &d.payload) { - Some(super::DocPayload::Meta(meta)) if meta.source_format().is_binary() => { + Some(crate::state::DocPayload::Meta(meta)) if meta.source_format().is_binary() => { meta.source_format().label() } _ => { diff --git a/src/state/the_dressed_ped.rs b/src/state/tests/the_dressed_ped.rs similarity index 94% rename from src/state/the_dressed_ped.rs rename to src/state/tests/the_dressed_ped.rs index 0e53d35cc..e16b0aa49 100644 --- a/src/state/the_dressed_ped.rs +++ b/src/state/tests/the_dressed_ped.rs @@ -12,15 +12,15 @@ use or_io::codec::texture::{save_png, RgbaImage}; use or_source::cook::Recook; use or_test_support::{game_roots, skip_corpus, skip_install, Corpus, TARGET_GEN8}; -use super::front_door::{NewProject, Template}; -use super::os_drop::DropTarget; -use super::{AppState, Prefs}; +use crate::state::front_door::{NewProject, Template}; +use crate::state::os_drop::DropTarget; use crate::state::Workspace; +use crate::state::{AppState, Prefs}; -pub(super) const WHAT: &str = "the_dressed_ped"; -pub(super) const C: &str = "mp_m_freemode_01_mp_m_t"; +pub(in crate::state) const WHAT: &str = "the_dressed_ped"; +pub(in crate::state) const C: &str = "mp_m_freemode_01_mp_m_t"; -pub(super) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) -> bool) { +pub(in crate::state) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) -> bool) { let deadline = Instant::now() + Duration::from_secs(60); loop { state.poll_workbench(); @@ -44,7 +44,7 @@ pub(super) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) - } /// The smallest staged files of `extension` that open and, for a model, hold geometry. -pub(super) fn staged(extension: &str, count: usize) -> Option> { +pub(in crate::state) fn staged(extension: &str, count: usize) -> Option> { let mut files = Corpus::new(env!("CARGO_MANIFEST_DIR"), extension) .target(TARGET_GEN8) .find_or_skip(WHAT)?; @@ -90,10 +90,10 @@ fn png(path: &Path, shade: u8) { } /// A clothing project holding a jacket (two textures) and a pair of shoes, open on the Wardrobe. -pub(super) struct Fitted { - pub(super) state: AppState, - pub(super) jacket: String, - pub(super) shoes: String, +pub(in crate::state) struct Fitted { + pub(in crate::state) state: AppState, + pub(in crate::state) jacket: String, + pub(in crate::state) shoes: String, /// Last, so the workers and the watchers are gone before their folder is. _dir: tempfile::TempDir, } @@ -103,13 +103,13 @@ fn fitted() -> Option { } /// What the first mesh of the first part is made of, which another model does not share. -pub(super) fn first_mesh(f: &Fitted) -> (usize, usize) { +pub(in crate::state) fn first_mesh(f: &Fitted) -> (usize, usize) { let mesh = &f.scene_parts()[0].geometry[0]; (mesh.vertices.len(), mesh.indices.len()) } /// The smallest staged model whose medium level has fewer triangles than its high one, and the smallest other one. -pub(super) fn staged_with_levels() -> Option> { +pub(in crate::state) fn staged_with_levels() -> Option> { let mut files = Corpus::new(env!("CARGO_MANIFEST_DIR"), "ydd") .target(TARGET_GEN8) .find_or_skip(WHAT)?; @@ -137,12 +137,12 @@ pub(super) fn staged_with_levels() -> Option> { Some(vec![many.0.clone(), other.0.clone()]) } -pub(super) fn fitted_from(models: Vec) -> Option { +pub(in crate::state) fn fitted_from(models: Vec) -> Option { fitted_dropping(models, false) } /// The same pack with a hat in it as well, which is a third garment and the second model worn on the head. -pub(super) fn fitted_dropping(models: Vec, with_hat: bool) -> Option { +pub(in crate::state) fn fitted_dropping(models: Vec, with_hat: bool) -> Option { let textures = staged("ytd", 3)?; let dir = tempfile::tempdir().unwrap(); let mut draft = NewProject::new(Template::Clothing, dir.path().to_path_buf()); @@ -203,20 +203,22 @@ pub(super) fn fitted_dropping(models: Vec, with_hat: bool) -> Option &[crate::state::workbench::dressed::scene::ScenePart] { + pub(in crate::state) fn scene_parts( + &self, + ) -> &[crate::state::workbench::dressed::scene::ScenePart] { &self .state .workbench @@ -462,7 +464,7 @@ fn a_cook_that_lands_lets_a_model_ask_the_project_for_its_textures_again() { #[test] fn a_file_a_recook_wrote_is_asked_about_as_refreshed_and_not_as_changed_by_somebody_else() { - use super::document::{DocPayload, Document}; + use crate::state::document::{DocPayload, Document}; let dir = tempfile::tempdir().unwrap(); let cooked = dir.path().join("logo.ytd"); std::fs::write(&cooked, b"x").unwrap(); @@ -559,7 +561,7 @@ fn each_preset_of_the_animation_is_a_clip_of_the_installs_default_movement_and_d !d.is_reading() && d.skeleton(s.dressed_ped()).is_some() }); - for (at, preset) in super::workbench::PRESETS.iter().enumerate() { + for (at, preset) in crate::state::workbench::PRESETS.iter().enumerate() { f.state.workbench.wardrobe.dressed.stop_clip(); f.state.play_preset(at); until(&mut f.state, preset.label, |s| { diff --git a/src/state/the_dressed_ped_shows_sets_the_first_person_view_and_the_floor_of_heels.rs b/src/state/tests/the_dressed_ped_shows_sets_the_first_person_view_and_the_floor_of_heels.rs similarity index 99% rename from src/state/the_dressed_ped_shows_sets_the_first_person_view_and_the_floor_of_heels.rs rename to src/state/tests/the_dressed_ped_shows_sets_the_first_person_view_and_the_floor_of_heels.rs index 1b7d57b14..392782454 100644 --- a/src/state/the_dressed_ped_shows_sets_the_first_person_view_and_the_floor_of_heels.rs +++ b/src/state/tests/the_dressed_ped_shows_sets_the_first_person_view_and_the_floor_of_heels.rs @@ -13,9 +13,9 @@ use or_wardrobe::edit::Edit; use or_wardrobe::Ped; use super::the_dressed_ped::{first_mesh, fitted_dropping, staged, until, Fitted}; -use super::workbench::AlternatesEdit; -use super::AppState; use crate::render::viewport::CameraInputs; +use crate::state::workbench::AlternatesEdit; +use crate::state::AppState; /// The id of the head prop the fixture's pack holds. fn the_hat(f: &Fitted) -> String { diff --git a/src/state/the_dressed_ped_wears_props.rs b/src/state/tests/the_dressed_ped_wears_props.rs similarity index 100% rename from src/state/the_dressed_ped_wears_props.rs rename to src/state/tests/the_dressed_ped_wears_props.rs diff --git a/src/state/the_edit_mode_is_visible_and_honest.rs b/src/state/tests/the_edit_mode_is_visible_and_honest.rs similarity index 97% rename from src/state/the_edit_mode_is_visible_and_honest.rs rename to src/state/tests/the_edit_mode_is_visible_and_honest.rs index 9ff0b95e8..5372bde05 100644 --- a/src/state/the_edit_mode_is_visible_and_honest.rs +++ b/src/state/tests/the_edit_mode_is_visible_and_honest.rs @@ -4,9 +4,9 @@ use std::path::PathBuf; use super::destructive_file_operations_ask::node_at; -use super::document::{DocumentId, RpfNodeId}; -use super::prefs::EditMode; -use super::{AppState, GateOutcome, RetailEditDecision}; +use crate::state::document::{DocumentId, RpfNodeId}; +use crate::state::prefs::EditMode; +use crate::state::{AppState, GateOutcome, RetailEditDecision}; /// An install holding a shipped `update` folder, mounted as the app mounts one. fn mounted_install() -> (tempfile::TempDir, PathBuf, AppState, DocumentId, RpfNodeId) { diff --git a/src/state/the_files_view_in_the_centre/keys.rs b/src/state/tests/the_files_view_in_the_centre/keys.rs similarity index 100% rename from src/state/the_files_view_in_the_centre/keys.rs rename to src/state/tests/the_files_view_in_the_centre/keys.rs diff --git a/src/state/the_files_view_in_the_centre/mod.rs b/src/state/tests/the_files_view_in_the_centre/mod.rs similarity index 85% rename from src/state/the_files_view_in_the_centre/mod.rs rename to src/state/tests/the_files_view_in_the_centre/mod.rs index c33f41118..16f8c9615 100644 --- a/src/state/the_files_view_in_the_centre/mod.rs +++ b/src/state/tests/the_files_view_in_the_centre/mod.rs @@ -7,15 +7,15 @@ mod keys; -use super::files_view::inner_of_address; -use super::{AppState, DocPayload, DocumentId, DocumentKind, Prefs, RpfNodeId}; +use crate::state::files_view::inner_of_address; use crate::state::panel_ids as ids; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind, Prefs, RpfNodeId}; use crate::ui::panels::hierarchy::{ui_state, FilesViewUi}; const SCREEN: egui::Vec2 = egui::vec2(1600.0, 900.0); /// One frame of the dock and the floating windows, with `modifiers` held. -pub(super) fn run( +pub(in crate::state) fn run( ctx: &egui::Context, state: &mut AppState, events: Vec, @@ -34,7 +34,7 @@ pub(super) fn run( } /// Every labelled widget a frame laid out, and its centre. -pub(super) fn labels(output: &egui::FullOutput) -> Vec<(String, egui::Pos2)> { +pub(in crate::state) fn labels(output: &egui::FullOutput) -> Vec<(String, egui::Pos2)> { let Some(update) = &output.platform_output.accesskit_update else { return Vec::new(); }; @@ -50,7 +50,7 @@ pub(super) fn labels(output: &egui::FullOutput) -> Vec<(String, egui::Pos2)> { .collect() } -pub(super) fn frame( +pub(in crate::state) fn frame( ctx: &egui::Context, state: &mut AppState, events: Vec, @@ -59,7 +59,7 @@ pub(super) fn frame( } /// Where the workspace on screen last laid out the leaf holding `panel`. -pub(super) fn leaf_of(state: &AppState, panel: &str) -> egui::Rect { +pub(in crate::state) fn leaf_of(state: &AppState, panel: &str) -> egui::Rect { state .workspace_docks .peek(state.active_workspace) @@ -75,14 +75,14 @@ pub(super) fn leaf_of(state: &AppState, panel: &str) -> egui::Rect { } /// An empty spot in the listing, below its rows and left of the preview pane. -pub(super) fn in_the_listing(state: &AppState) -> egui::Pos2 { +pub(in crate::state) fn in_the_listing(state: &AppState) -> egui::Pos2 { let centre = leaf_of(state, ids::DOCUMENT); egui::pos2(centre.left() + 120.0, centre.bottom() - 70.0) } /// An archive in Browse: `props` holding two drawables, `textures` an empty /// folder, and two files beside them. -pub(super) fn browsing() -> (AppState, DocumentId) { +pub(in crate::state) fn browsing() -> (AppState, DocumentId) { let mut state = AppState::from_prefs(Prefs::default()); let doc = state.new_empty_document(DocumentKind::Rpf); let Some(DocPayload::Rpf(rpf)) = state.document_mut(doc).map(|d| &mut d.payload) else { @@ -108,12 +108,12 @@ pub(super) fn browsing() -> (AppState, DocumentId) { (state, doc) } -pub(super) fn node(state: &AppState, doc: DocumentId, path: &str) -> RpfNodeId { +pub(in crate::state) fn node(state: &AppState, doc: DocumentId, path: &str) -> RpfNodeId { let Some(DocPayload::Rpf(rpf)) = state.document(doc).map(|d| &d.payload) else { panic!("the archive is open"); }; - match super::navigation::resolve_path(&rpf.session, path) { - super::navigation::Resolved::Found(id) => id, + match crate::state::navigation::resolve_path(&rpf.session, path) { + crate::state::navigation::Resolved::Found(id) => id, other => panic!("{path}: {other:?}"), } } @@ -127,7 +127,7 @@ fn name_of(state: &AppState, doc: DocumentId, id: RpfNodeId) -> String { } /// The names the Files view listed last frame, in order. -pub(super) fn listed(state: &AppState, doc: DocumentId) -> Vec { +pub(in crate::state) fn listed(state: &AppState, doc: DocumentId) -> Vec { state .panels .get::() @@ -149,7 +149,7 @@ fn button(at: egui::Pos2, button: egui::PointerButton, pressed: bool) -> egui::E } } -pub(super) fn click_with( +pub(in crate::state) fn click_with( ctx: &egui::Context, state: &mut AppState, at: egui::Pos2, @@ -163,12 +163,12 @@ pub(super) fn click_with( frame(ctx, state, vec![button(at, which, false)]); } -pub(super) fn click(ctx: &egui::Context, state: &mut AppState, at: egui::Pos2) { +pub(in crate::state) fn click(ctx: &egui::Context, state: &mut AppState, at: egui::Pos2) { click_with(ctx, state, at, egui::PointerButton::Primary); } /// What the submenu `opener` of the open menu `menu` offers, once a click on its row has opened it. -pub(super) fn submenu( +pub(in crate::state) fn submenu( ctx: &egui::Context, state: &mut AppState, menu: &[(String, egui::Pos2)], @@ -207,7 +207,11 @@ fn key(ctx: &egui::Context, state: &mut AppState, key: egui::Key) { } /// The centre of the first widget labelled `label`, after any icon glyphs, inside `area`. -pub(super) fn find(shown: &[(String, egui::Pos2)], area: egui::Rect, label: &str) -> egui::Pos2 { +pub(in crate::state) fn find( + shown: &[(String, egui::Pos2)], + area: egui::Rect, + label: &str, +) -> egui::Pos2 { shown .iter() .find(|(text, at)| labelled(text, label) && area.contains(*at)) @@ -220,12 +224,15 @@ fn labelled(text: &str, label: &str) -> bool { text.trim_start_matches(|c: char| ('\u{e000}'..='\u{f8ff}').contains(&c)) == label } -pub(super) fn settled(ctx: &egui::Context, state: &mut AppState) -> Vec<(String, egui::Pos2)> { +pub(in crate::state) fn settled( + ctx: &egui::Context, + state: &mut AppState, +) -> Vec<(String, egui::Pos2)> { frame(ctx, state, Vec::new()); frame(ctx, state, Vec::new()) } -pub(super) fn accessible() -> egui::Context { +pub(in crate::state) fn accessible() -> egui::Context { let ctx = egui::Context::default(); ctx.enable_accesskit(); ctx diff --git a/src/state/the_front_door.rs b/src/state/tests/the_front_door.rs similarity index 97% rename from src/state/the_front_door.rs rename to src/state/tests/the_front_door.rs index 4254e302c..48e7a4601 100644 --- a/src/state/the_front_door.rs +++ b/src/state/tests/the_front_door.rs @@ -8,11 +8,11 @@ use std::path::Path; use std::time::{Duration, Instant}; -use super::document::{Document, TextDocument}; -use super::project::{load_project, save_project, ProjectDocument, ProjectFile}; -use super::rpf_session::RpfEntryBinding; -use super::{AppState, CloseAnswer, DocPayload, DocumentKind, Game, LoadingState, Prefs}; +use crate::state::document::{Document, TextDocument}; +use crate::state::project::{load_project, save_project, ProjectDocument, ProjectFile}; +use crate::state::rpf_session::RpfEntryBinding; use crate::state::Workspace; +use crate::state::{AppState, CloseAnswer, DocPayload, DocumentKind, Game, LoadingState, Prefs}; use crate::ui::dock::WorkspaceDocks; fn remembering(game: Game, root: &Path) -> Prefs { diff --git a/src/state/the_front_door_opens_and_closes.rs b/src/state/tests/the_front_door_opens_and_closes.rs similarity index 95% rename from src/state/the_front_door_opens_and_closes.rs rename to src/state/tests/the_front_door_opens_and_closes.rs index 637d787e8..ad34775f6 100644 --- a/src/state/the_front_door_opens_and_closes.rs +++ b/src/state/tests/the_front_door_opens_and_closes.rs @@ -4,9 +4,9 @@ use std::path::{Path, PathBuf}; use std::time::{Duration, Instant}; -use super::jobs::JobKind; -use super::project::{save_project, ProjectFile}; -use super::{AppState, CloseAnswer, Prefs}; +use crate::state::jobs::JobKind; +use crate::state::project::{save_project, ProjectFile}; +use crate::state::{AppState, CloseAnswer, Prefs}; fn a_project(dir: &Path, name: &str) -> PathBuf { let file = dir.join(name).join(format!("{name}.openrage-proj")); diff --git a/src/state/the_gate_in_front_of_every_write.rs b/src/state/tests/the_gate_in_front_of_every_write.rs similarity index 89% rename from src/state/the_gate_in_front_of_every_write.rs rename to src/state/tests/the_gate_in_front_of_every_write.rs index b9bad4b81..9f35b2661 100644 --- a/src/state/the_gate_in_front_of_every_write.rs +++ b/src/state/tests/the_gate_in_front_of_every_write.rs @@ -7,7 +7,7 @@ use std::path::Path; -use super::prefs::EditMode; +use crate::state::prefs::EditMode; /// Every write path asks the gate. /// @@ -21,17 +21,17 @@ fn the_gate_stands_in_front_of_every_write() { /// (file, function, why it is a write) const WRITES: &[(&str, &str, &str)] = &[ ( - "file_io.rs", + "file_io/mod.rs", "save_active_document", "Ctrl+S on a loose file, which reaches spawn_save", ), ( - "file_io.rs", + "file_io/mod.rs", "save_active_document_as", "Save As to a path the picker offered", ), ( - "file_io.rs", + "file_io/mod.rs", "save_dirty_archives", "rebuilding and replacing an archive on disk", ), @@ -82,14 +82,18 @@ fn the_gate_stands_in_front_of_every_write() { "answer_mod_move", "moving a mod's folder between the mods overlay and mods_", ), - ("rpf_tree.rs", "rpf_add_folder", "a folder in an archive"), ( - "rpf_tree.rs", + "rpf/rpf_tree.rs", + "rpf_add_folder", + "a folder in an archive", + ), + ( + "rpf/rpf_tree.rs", "rpf_rename_node", "renaming an archive entry", ), ( - "rpf_tree.rs", + "rpf/rpf_tree.rs", "rpf_delete_node", "deleting an archive entry", ), @@ -99,12 +103,12 @@ fn the_gate_stands_in_front_of_every_write() { "the delete itself, once its question is answered", ), ( - "rpf_moves.rs", + "rpf/rpf_moves.rs", "rpf_move_nodes", "moving archive entries or files on disk, one row or several", ), ( - "rpf_tree.rs", + "rpf/rpf_tree.rs", "rpf_import_file_to_folder", "importing a file into an archive", ), @@ -140,32 +144,32 @@ fn the_gate_stands_in_front_of_every_write() { "rebuilding an overlay copy from the patched archive", ), ( - "gta6_resource_save.rs", + "gta6/bodies/gta6_resource_save/mod.rs", "save_edited_resource", "saving a GTA VI resource file's edited sections over it", ), ( - "rpf9_scan.rs", + "rpf/rpf9_scan/mod.rs", "extract_scanned_bodies", "writing the bodies a scan found into the folder a picker chose", ), ( - "gta6_modding/batch_export.rs", + "gta6/modding/batch_export.rs", "gta6_batch_export", "writing GTA VI files as people open them into the folder a picker chose", ), ( - "gta6_modding/text_search.rs", + "gta6/modding/text_search/mod.rs", "save_gta6_text_edits", "writing copies of GTA VI archives with edited texts into the folder a picker chose", ), ( - "gta6_modding/mod_package.rs", + "gta6/modding/mod_package/mod.rs", "make_gta6_package_in", "writing a GTA VI mod package into the folder a picker chose", ), ( - "gta6_archive_save.rs", + "rpf/rpf9_scan/rpf9_table/gta6_archive_save/mod.rs", "write_copy_on_worker", "writing a copy of a GTA VI archive with edits to the path a picker chose", ), @@ -195,12 +199,12 @@ fn the_gate_stands_in_front_of_every_write() { "writing search results TSV to a path a picker chose", ), ( - "gta6_textures.rs", + "gta6/textures/gta6_textures.rs", "export_texture_to", "writing a texture as PNG or DDS to a path a picker chose", ), ( - "gta6_textures.rs", + "gta6/textures/gta6_textures.rs", "export_bound_texture", "writing a bound GTA VI texture to a path a picker chose", ), @@ -261,7 +265,7 @@ fn the_gate_stands_in_front_of_every_write() { // The gate must also be the only thing that decides, so the raw predicate // stays out of the write paths. - let file_io = std::fs::read_to_string(dir.join("file_io.rs")).expect("file_io.rs"); + let file_io = std::fs::read_to_string(dir.join("file_io/mod.rs")).expect("file_io/mod.rs"); let stray = file_io.matches("classify(").count(); assert!( stray <= 1, @@ -281,7 +285,7 @@ fn every_confirmable_action_can_be_applied() { let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("src/state"); let prompts = std::fs::read_to_string(dir.join("pending_prompts.rs")).expect("pending_prompts.rs"); - let tree = std::fs::read_to_string(dir.join("rpf_tree.rs")).expect("rpf_tree.rs"); + let tree = std::fs::read_to_string(dir.join("rpf/rpf_tree.rs")).expect("rpf/rpf_tree.rs"); let declared = variants_of(&prompts, "pub enum PendingRetailEdit"); assert!( @@ -314,12 +318,12 @@ fn an_edit_outside_the_overlay_offers_the_copy() { let shipped = install.join("update").join("update.rpf"); std::fs::write(&shipped, b"shipped archive").expect("archive"); - let mut state = super::AppState::new(); + let mut state = crate::state::AppState::new(); state.retail_edit_session_allow = false; state.prefs.edit_mode = EditMode::Overlay; assert!(matches!( state.gate_permits(Some(&shipped)), - super::GateOutcome::Refused + crate::state::GateOutcome::Refused )); let offer = state .overlay_copy @@ -336,7 +340,7 @@ fn an_edit_outside_the_overlay_offers_the_copy() { state.prefs.edit_mode = EditMode::ReadOnly; assert!(matches!( state.gate_permits(Some(&shipped)), - super::GateOutcome::Refused + crate::state::GateOutcome::Refused )); assert_eq!(state.overlay_copy.offer, None); } @@ -354,23 +358,25 @@ fn a_refused_archive_in_the_mounted_install_is_not_written() { let shipped = install.join("update").join("update.rpf"); let dest = install.join("mods").join("update").join("update.rpf"); - let mut state = super::AppState::new(); + let mut state = crate::state::AppState::new(); state.retail_edit_session_allow = false; state.prefs.edit_mode = EditMode::Overlay; - let bytes = super::document_io::serialize_archive_records( + let bytes = crate::state::document_io::serialize_archive_records( vec![("a.txt".to_string(), b"entry".to_vec(), false)], - super::RpfOutputMode::Open, + crate::state::RpfOutputMode::Open, state.keys.provider(), ) .expect("archive bytes"); std::fs::write(&shipped, &bytes).expect("archive"); - let archive = super::rpf_archive_open::open_archive_from_disk(&shipped, state.keys.provider()) - .expect("open the archive"); + let archive = + crate::state::rpf_archive_open::open_archive_from_disk(&shipped, state.keys.provider()) + .expect("open the archive"); state.open_game_root(install.clone()); let doc_id = state.documents[0].id; let entry = { - let Some(super::DocPayload::Rpf(rpf)) = state.document_mut(doc_id).map(|d| &mut d.payload) + let Some(crate::state::DocPayload::Rpf(rpf)) = + state.document_mut(doc_id).map(|d| &mut d.payload) else { panic!("the install mounts as a GameRoot"); }; @@ -383,12 +389,12 @@ fn a_refused_archive_in_the_mounted_install_is_not_written() { .session .register_archive(archive.clone(), Some(shipped.clone())) .expect("an id for the archive"); - if let Some(super::RpfNodeBacking::Archive { archive_id, .. }) = + if let Some(crate::state::RpfNodeBacking::Archive { archive_id, .. }) = rpf.session.node_mut(node).map(|n| &mut n.backing) { *archive_id = Some(id); } - let listing = super::expander::list_archive(archive.clone()).expect("list"); + let listing = crate::state::expander::list_archive(archive.clone()).expect("list"); rpf.session .populate_archive_children(node, id, &listing) .expect("populate"); @@ -430,23 +436,25 @@ fn read_only_refuses_saving_an_archive_in_the_overlay() { std::fs::write(install.join("gta5.exe"), b"an install marker").expect("marker"); let overlay = install.join("mods").join("update").join("update.rpf"); - let mut state = super::AppState::new(); + let mut state = crate::state::AppState::new(); state.retail_edit_session_allow = false; state.prefs.edit_mode = EditMode::ReadOnly; - let bytes = super::document_io::serialize_archive_records( + let bytes = crate::state::document_io::serialize_archive_records( vec![("a.txt".to_string(), b"entry".to_vec(), false)], - super::RpfOutputMode::Open, + crate::state::RpfOutputMode::Open, state.keys.provider(), ) .expect("archive bytes"); std::fs::write(&overlay, &bytes).expect("archive"); - let archive = super::rpf_archive_open::open_archive_from_disk(&overlay, state.keys.provider()) - .expect("open the archive"); + let archive = + crate::state::rpf_archive_open::open_archive_from_disk(&overlay, state.keys.provider()) + .expect("open the archive"); state.open_game_root(install.clone()); let doc_id = state.documents[0].id; { - let Some(super::DocPayload::Rpf(rpf)) = state.document_mut(doc_id).map(|d| &mut d.payload) + let Some(crate::state::DocPayload::Rpf(rpf)) = + state.document_mut(doc_id).map(|d| &mut d.payload) else { panic!("the install mounts as a GameRoot"); }; @@ -459,12 +467,12 @@ fn read_only_refuses_saving_an_archive_in_the_overlay() { .session .register_archive(archive.clone(), Some(overlay.clone())) .expect("an id for the archive"); - if let Some(super::RpfNodeBacking::Archive { archive_id, .. }) = + if let Some(crate::state::RpfNodeBacking::Archive { archive_id, .. }) = rpf.session.node_mut(node).map(|n| &mut n.backing) { *archive_id = Some(id); } - let listing = super::expander::list_archive(archive.clone()).expect("list"); + let listing = crate::state::expander::list_archive(archive.clone()).expect("list"); rpf.session .populate_archive_children(node, id, &listing) .expect("populate"); @@ -496,14 +504,14 @@ fn no_mode_writes_into_gta_vi_s_install() { std::fs::write(&shipped, b"shipped archive").expect("archive"); let in_mods = tmp.path().join("mods").join("common.rpf"); - let mut state = super::AppState::new(); + let mut state = crate::state::AppState::new(); state.retail_edit_session_allow = true; for mode in EditMode::ALL { state.prefs.edit_mode = mode; for target in [tmp.path(), shipped.as_path(), in_mods.as_path()] { assert_eq!( state.gate_permits(Some(target)), - super::GateOutcome::Refused, + crate::state::GateOutcome::Refused, "{mode:?} wrote into {target:?}" ); } diff --git a/src/state/the_grid_and_undo_survive_an_edit_of_the_contents.rs b/src/state/tests/the_grid_and_undo_survive_an_edit_of_the_contents.rs similarity index 98% rename from src/state/the_grid_and_undo_survive_an_edit_of_the_contents.rs rename to src/state/tests/the_grid_and_undo_survive_an_edit_of_the_contents.rs index b081c53ce..5aa12a542 100644 --- a/src/state/the_grid_and_undo_survive_an_edit_of_the_contents.rs +++ b/src/state/tests/the_grid_and_undo_survive_an_edit_of_the_contents.rs @@ -7,7 +7,7 @@ use or_test_support::skip_corpus; use super::an_edit_stays_where_it_was_made::{ drawable_with_a_material, grid_row, open, texts, Inspector, }; -use super::{AppState, DocPayload, DocumentId, SelectionKey}; +use crate::state::{AppState, DocPayload, DocumentId, SelectionKey}; /// A staged Legacy drawable opened from a scratch copy and active, and its material that carries a float. struct Opened { diff --git a/src/state/the_inspector_leads_with_a_summary.rs b/src/state/tests/the_inspector_leads_with_a_summary.rs similarity index 93% rename from src/state/the_inspector_leads_with_a_summary.rs rename to src/state/tests/the_inspector_leads_with_a_summary.rs index 658f38b93..a08c05494 100644 --- a/src/state/the_inspector_leads_with_a_summary.rs +++ b/src/state/tests/the_inspector_leads_with_a_summary.rs @@ -11,8 +11,8 @@ use std::path::Path; use egui::accesskit::Role; use super::opening_a_ydd::finish_load; -use super::prefs::Game; -use super::{AppState, CloseAnswer, DocumentId}; +use crate::state::prefs::Game; +use crate::state::{AppState, CloseAnswer, DocumentId}; const WHAT: &str = "the default inspector of every corpus kind"; @@ -27,7 +27,7 @@ fn drawn(state: &mut AppState) -> Vec<(Role, String)> { } /// Every text `draw` lays out over three frames: its role and its words. -pub(super) fn drawn_by( +pub(in crate::state) fn drawn_by( state: &mut AppState, draw: impl Fn(&mut egui::Ui, &mut AppState), ) -> Vec<(Role, String)> { @@ -91,7 +91,7 @@ fn internal_names(state: &AppState, doc: DocumentId) -> BTreeSet { } /// A grid label's own field: `Base > LodGroup > LodDistances [0]` is `LodDistances`. -pub(super) fn leaf(label: &str) -> &str { +pub(in crate::state) fn leaf(label: &str) -> &str { let last = label.rsplit(" > ").next().unwrap_or(label); match last.rsplit_once(" [") { Some((name, index)) if index.ends_with(']') => name, @@ -205,17 +205,23 @@ mod no_vtable_word_count_or_pointer_shows_in_the_default_inspector_of_any_corpus } /// The key a dictionary's first entry is selected by, or a drawable's first shader's effect. -fn a_hash_in(payload: &super::DocPayload) -> Option<(Option, u32)> { +fn a_hash_in( + payload: &crate::state::DocPayload, +) -> Option<(Option, u32)> { use crate::state::SelectionKey; use or_io::Asset; let entry = |key: u32| (Some(SelectionKey::dict_entry(key)), key); match payload { - super::DocPayload::Resource(Asset::DrawableDict(d)) => d.codes.first().copied().map(entry), - super::DocPayload::Resource(Asset::ClothDict(d)) => d.codes.first().copied().map(entry), - super::DocPayload::Resource(Asset::Clips(d)) => { + crate::state::DocPayload::Resource(Asset::DrawableDict(d)) => { + d.codes.first().copied().map(entry) + } + crate::state::DocPayload::Resource(Asset::ClothDict(d)) => { + d.codes.first().copied().map(entry) + } + crate::state::DocPayload::Resource(Asset::Clips(d)) => { or_anim::clip::clips(d).next().map(|(key, _)| entry(key)) } - super::DocPayload::Resource(Asset::Drawable(d)) => { + crate::state::DocPayload::Resource(Asset::Drawable(d)) => { let shader = d.shader_group.as_deref()?.shaders.first()?; Some((None, shader.basis_hash.get())) } @@ -224,7 +230,7 @@ fn a_hash_in(payload: &super::DocPayload) -> Option<(Option Vec { +pub(in crate::state) fn other_spellings(texts: &[(Role, String)], hash: u32) -> Vec { let one = format!("0x{hash:08X}"); let others = [ format!("{hash:08X}"), diff --git a/src/state/the_lock_a_window_holds.rs b/src/state/tests/the_lock_a_window_holds.rs similarity index 99% rename from src/state/the_lock_a_window_holds.rs rename to src/state/tests/the_lock_a_window_holds.rs index 885fd79fc..b37bb8618 100644 --- a/src/state/the_lock_a_window_holds.rs +++ b/src/state/tests/the_lock_a_window_holds.rs @@ -10,8 +10,8 @@ use or_source::sample::drawable_dictionary; use super::importing_game_files_from_the_app::{imported, project, until}; use super::the_project_workspace::opened; -use super::{AppState, Prefs}; use crate::state::Workspace; +use crate::state::{AppState, Prefs}; /// A window with nothing open, which loads the project at `file`. fn a_window_on(file: &Path) -> AppState { diff --git a/src/state/the_map_screen_holds_a_session.rs b/src/state/tests/the_map_screen_holds_a_session.rs similarity index 98% rename from src/state/the_map_screen_holds_a_session.rs rename to src/state/tests/the_map_screen_holds_a_session.rs index c8ecdbb54..82ae733b5 100644 --- a/src/state/the_map_screen_holds_a_session.rs +++ b/src/state/tests/the_map_screen_holds_a_session.rs @@ -21,16 +21,16 @@ use or_maps::sample::{ use or_maps::{delete, Name}; use or_world::transform::Pose; -use super::front_door::{NewProject, Template}; use super::the_wardrobe_workspace::{bare, until, write}; -use super::workbench::{Pick, PickKind}; -use super::{AppState, CloseAnswer, ToastType}; +use crate::state::front_door::{NewProject, Template}; +use crate::state::workbench::{Pick, PickKind}; use crate::state::Workspace; +use crate::state::{AppState, CloseAnswer, ToastType}; const SLOD: &str = "city_slod.metadata.src"; const LOD: &str = "city_lod.metadata.src"; const CITY: &str = "city.metadata.src"; -pub(super) const HARBOUR: &str = "harbour.metadata.src"; +pub(in crate::state) const HARBOUR: &str = "harbour.metadata.src"; const TYPES: &str = "harbour_types.metadata.src"; const EXTENTS: ([f32; 3], [f32; 3]) = ([0.0; 3], [100.0; 3]); @@ -74,7 +74,7 @@ fn a_pack_within(dir: &Path, files: &[(&str, Vec)], long: Duration) -> (AppS } /// Two crates, one turned, and the type file that declares them. -pub(super) fn harbour(dir: &Path) -> (AppState, PathBuf) { +pub(in crate::state) fn harbour(dir: &Path) -> (AppState, PathBuf) { let map = map_file( "harbour", &[ @@ -163,12 +163,12 @@ fn city(dir: &Path) -> (AppState, PathBuf) { ) } -pub(super) fn folder(state: &AppState) -> PathBuf { +pub(in crate::state) fn folder(state: &AppState) -> PathBuf { state.maps_pack().expect("a pack").folder.clone() } /// Every file of the sources of the pack in `folder`, by its path inside it: the pack's own file, which remembers the names a person types, is not one. -pub(super) fn sources(folder: &Path) -> BTreeMap> { +pub(in crate::state) fn sources(folder: &Path) -> BTreeMap> { fn walk(root: &Path, dir: &Path, into: &mut BTreeMap>) { for entry in std::fs::read_dir(dir).unwrap() { let path = entry.unwrap().path(); @@ -186,7 +186,7 @@ pub(super) fn sources(folder: &Path) -> BTreeMap> { } /// The sources of `one` that `other` does not hold with the same bytes, and the ones only `other` holds. -pub(super) fn differing( +pub(in crate::state) fn differing( one: &BTreeMap>, other: &BTreeMap>, ) -> Vec { @@ -229,7 +229,7 @@ fn select(state: &mut AppState, source: &str, kind: PickKind) { } /// Move the entity `index` of `source` to `x`, as the manipulator does when it is let go. -pub(super) fn move_to(state: &mut AppState, source: &str, index: usize, x: f32) { +pub(in crate::state) fn move_to(state: &mut AppState, source: &str, index: usize, x: f32) { select(state, source, PickKind::Entity(index)); let pose = state.selected_pose().expect("the entity selected stands"); let moved = Pose { @@ -268,14 +268,14 @@ fn shown(state: &AppState) -> BTreeMap>> { .collect() } -pub(super) fn said(state: &AppState, kind: ToastType) -> Vec { +pub(in crate::state) fn said(state: &AppState, kind: ToastType) -> Vec { (state.toasts.iter()) .filter(|toast| toast.toast_type == kind) .map(|toast| toast.message.clone()) .collect() } -pub(super) fn save(state: &mut AppState) { +pub(in crate::state) fn save(state: &mut AppState) { assert!( state.save_active_project(|_| None), "{:?}", diff --git a/src/state/the_map_screen_saves_with_the_project.rs b/src/state/tests/the_map_screen_saves_with_the_project.rs similarity index 94% rename from src/state/the_map_screen_saves_with_the_project.rs rename to src/state/tests/the_map_screen_saves_with_the_project.rs index a98f3e29a..8e52a651f 100644 --- a/src/state/the_map_screen_saves_with_the_project.rs +++ b/src/state/tests/the_map_screen_saves_with_the_project.rs @@ -11,17 +11,17 @@ use super::the_map_screen_holds_a_session::{ differing, folder, harbour, move_to, said, save, sources, HARBOUR, }; use super::the_wardrobe_workspace::until; -use super::workbench::{ConcernKind, Place, Question, Severity}; -use super::{AppState, ToastType}; +use crate::state::workbench::{ConcernKind, Place, Question, Severity}; use crate::state::Workspace; +use crate::state::{AppState, ToastType}; /// A text file open in a tab, with an edit nothing saved. -fn an_edited_tab(state: &mut AppState, path: &Path) -> super::DocumentId { +fn an_edited_tab(state: &mut AppState, path: &Path) -> crate::state::DocumentId { std::fs::write(path, "as it was saved").unwrap(); - let text = super::document::TextDocument::decode(b"as it was edited"); + let text = crate::state::document::TextDocument::decode(b"as it was edited"); let id = state.insert_document( path.to_path_buf(), - super::DocPayload::Text(text), + crate::state::DocPayload::Text(text), None, None, ); diff --git a/src/state/the_mesh_doctor_in_the_app.rs b/src/state/tests/the_mesh_doctor_in_the_app.rs similarity index 99% rename from src/state/the_mesh_doctor_in_the_app.rs rename to src/state/tests/the_mesh_doctor_in_the_app.rs index a7628b012..24678aceb 100644 --- a/src/state/the_mesh_doctor_in_the_app.rs +++ b/src/state/tests/the_mesh_doctor_in_the_app.rs @@ -13,7 +13,7 @@ use or_test_support::{Corpus, TARGET_GEN8}; use or_wardrobe::{Component, Garment, Ped, Slot, Wardrobe}; use super::the_wardrobe_workspace::{opened, until}; -use super::AppState; +use crate::state::AppState; use crate::ui::commands::{self, Action}; fn staged(name: &str) -> Option { diff --git a/src/state/the_panel_counts_the_apps_cpu_state.rs b/src/state/tests/the_panel_counts_the_apps_cpu_state.rs similarity index 96% rename from src/state/the_panel_counts_the_apps_cpu_state.rs rename to src/state/tests/the_panel_counts_the_apps_cpu_state.rs index c6e46c6fb..454120de4 100644 --- a/src/state/the_panel_counts_the_apps_cpu_state.rs +++ b/src/state/tests/the_panel_counts_the_apps_cpu_state.rs @@ -10,8 +10,8 @@ use std::sync::Arc; use or_io::container::RpfArchive; use super::nested_archives_survive_a_save::archive; -use super::rpf_session::RpfEditSession; -use super::{ArchiveSource, RpfNodeBacking}; +use crate::state::rpf_session::RpfEditSession; +use crate::state::{ArchiveSource, RpfNodeBacking}; /// An archive of `n` drawables, each in a folder of its own. fn archive_of(n: usize) -> Vec { diff --git a/src/state/the_panels_around_the_viewer_take_both_targets.rs b/src/state/tests/the_panels_around_the_viewer_take_both_targets.rs similarity index 97% rename from src/state/the_panels_around_the_viewer_take_both_targets.rs rename to src/state/tests/the_panels_around_the_viewer_take_both_targets.rs index 904010d9c..8255eafb6 100644 --- a/src/state/the_panels_around_the_viewer_take_both_targets.rs +++ b/src/state/tests/the_panels_around_the_viewer_take_both_targets.rs @@ -14,19 +14,19 @@ use or_io::gta5::{ use or_particle::list; use or_test_support::{skip_corpus, Corpus, TARGET_GEN9}; -use super::prefs::Prefs; -use super::textures::{ +use crate::state::prefs::Prefs; +use crate::state::selection_lookup::name_hash; +use crate::state::textures::{ texture_at, texture_for_selection, textures_in, TextureListing, TextureResolution, TextureSource, FRAGMENT_ENTRY_HASH, }; -use super::{capabilities, AppState, DictPart, DocPayload, DocumentId, SelectionKey}; -use crate::state::selection_lookup::name_hash; +use crate::state::{capabilities, AppState, DictPart, DocPayload, DocumentId, SelectionKey}; /// The code the fixture's one model is keyed by. -pub(super) const MODEL: u32 = 0x5EED_0002; +pub(in crate::state) const MODEL: u32 = 0x5EED_0002; /// What a target needs a fixture to say that its other half need not. -pub(super) trait Fixture: DrawableTarget + Clone + 'static { +pub(in crate::state) trait Fixture: DrawableTarget + Clone + 'static { fn texture(name: &str) -> Self::Texture; fn particles(list: PtxFxList) -> DocPayload; fn fragment(fragment: GtaFragType) -> DocPayload; @@ -93,7 +93,7 @@ fn drawable_with(texture: &str) -> RmcDrawable { } /// An effect firing an emitter rule and a particle rule, a texture of its own and a model carrying another. -pub(super) fn a_list() -> PtxFxList { +pub(in crate::state) fn a_list() -> PtxFxList { let mut fx = PtxFxList::::default(); assert!(list::add_effect(&mut fx, "fx")); assert!(list::add_emitter_rule(&mut fx, "em")); @@ -117,7 +117,7 @@ pub(super) fn a_list() -> PtxFxList { /// A fragment whose common drawable carries the texture `smoke`. // The struct update the lint asks for does not compile: both types hold private fields. #[allow(clippy::field_reassign_with_default)] -pub(super) fn a_fragment() -> GtaFragType { +pub(in crate::state) fn a_fragment() -> GtaFragType { let mut common = FragDrawable::::default(); common.base = drawable_with::("smoke"); let mut fragment = GtaFragType::::default(); diff --git a/src/state/the_project_history.rs b/src/state/tests/the_project_history.rs similarity index 96% rename from src/state/the_project_history.rs rename to src/state/tests/the_project_history.rs index 7c2c10d1a..e523a9ee1 100644 --- a/src/state/the_project_history.rs +++ b/src/state/tests/the_project_history.rs @@ -11,19 +11,19 @@ use or_source::asset::folder_name; use or_source::textures; use serde_json::Value; -use super::front_door::{NewProject, Template}; use super::importing_game_files_from_the_app::{imported, ytd}; -use super::project::ProjectDocument; -use super::{AppState, Prefs}; +use crate::state::front_door::{NewProject, Template}; +use crate::state::project::ProjectDocument; use crate::state::Workspace; +use crate::state::{AppState, Prefs}; use crate::ui::commands::{self, Action}; -pub(super) fn write(path: &Path, body: &[u8]) { +pub(in crate::state) fn write(path: &Path, body: &[u8]) { std::fs::create_dir_all(path.parent().unwrap()).unwrap(); std::fs::write(path, body).unwrap(); } -pub(super) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) -> bool) { +pub(in crate::state) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) -> bool) { let deadline = Instant::now() + Duration::from_secs(30); loop { state.poll_workbench(); @@ -36,14 +36,14 @@ pub(super) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) - } /// The Files project `harbor` in `dir`, opened in a state, and its project file. -pub(super) fn a_project(dir: &Path) -> (AppState, PathBuf) { +pub(in crate::state) fn a_project(dir: &Path) -> (AppState, PathBuf) { let mut draft = NewProject::new(Template::Files, dir.to_path_buf()); draft.set_name("harbor".into()); let file = draft.create().expect("a project").file; (open(&file), file) } -pub(super) fn open(file: &Path) -> AppState { +pub(in crate::state) fn open(file: &Path) -> AppState { let mut state = AppState::from_prefs(Prefs::default()); state.documents.clear(); state.active_document = None; @@ -53,24 +53,24 @@ pub(super) fn open(file: &Path) -> AppState { } /// Save the project where it is and read the file back. -pub(super) fn saved(state: &mut AppState, file: &Path) -> Vec { +pub(in crate::state) fn saved(state: &mut AppState, file: &Path) -> Vec { assert!(state.save_active_project(|_| None)); std::fs::read(file).expect("the project file") } -pub(super) fn script(folder: &Path, name: &str) -> PathBuf { +pub(in crate::state) fn script(folder: &Path, name: &str) -> PathBuf { let path = folder.join(name); write(&path, name.as_bytes()); path } -pub(super) fn members(state: &AppState) -> Vec { +pub(in crate::state) fn members(state: &AppState) -> Vec { (state.project_carried.members.iter()) .map(|m| m.path.file_name().unwrap().to_string_lossy().into_owned()) .collect() } -pub(super) fn builds(state: &AppState) -> Vec { +pub(in crate::state) fn builds(state: &AppState) -> Vec { (state.project_carried.container.outputs.iter()) .map(|o| o.id.clone()) .collect() diff --git a/src/state/the_project_history_across_imports_and_projects.rs b/src/state/tests/the_project_history_across_imports_and_projects.rs similarity index 99% rename from src/state/the_project_history_across_imports_and_projects.rs rename to src/state/tests/the_project_history_across_imports_and_projects.rs index 73114005a..aa9db6259 100644 --- a/src/state/the_project_history_across_imports_and_projects.rs +++ b/src/state/tests/the_project_history_across_imports_and_projects.rs @@ -9,9 +9,9 @@ use or_source::asset::folder_name; use or_source::textures; use super::importing_game_files_from_the_app::ytd; -use super::project::ProjectDocument; use super::the_project_history::{a_project, builds, members, open, script, until, write}; -use super::AppState; +use crate::state::project::ProjectDocument; +use crate::state::AppState; /// The source `name.ytd` becomes in the project of `folder`. fn source(folder: &Path, name: &str) -> PathBuf { diff --git a/src/state/the_project_polish.rs b/src/state/tests/the_project_polish.rs similarity index 93% rename from src/state/the_project_polish.rs rename to src/state/tests/the_project_polish.rs index cef7313a7..b90cddbdb 100644 --- a/src/state/the_project_polish.rs +++ b/src/state/tests/the_project_polish.rs @@ -2,7 +2,7 @@ //! and a project follows a source folder that moved. use super::the_project_workspace::{opened, row, until}; -use super::workbench::{LastBuild, Severity}; +use crate::state::workbench::{LastBuild, Severity}; use or_project::Reproducible; #[test] @@ -33,7 +33,7 @@ fn opening_a_project_that_names_a_missing_file_lists_it_in_problems_and_raises_n } /// A project of one script that builds, opened in a state, and its project file. -fn a_buildable_project(dir: &std::path::Path) -> (super::AppState, std::path::PathBuf) { +fn a_buildable_project(dir: &std::path::Path) -> (crate::state::AppState, std::path::PathBuf) { let (mut state, file) = opened(dir); until(&mut state, "the scan", |s| s.workbench.is_scanned()); state.remove_asset(&row(&state, "missing_hat.ydd").key.clone()); @@ -43,7 +43,7 @@ fn a_buildable_project(dir: &std::path::Path) -> (super::AppState, std::path::Pa (state, file) } -fn build_and_wait(state: &mut super::AppState) -> crate::state::workbench::BuiltSummary { +fn build_and_wait(state: &mut crate::state::AppState) -> crate::state::workbench::BuiltSummary { state.build_selected(); until(state, "the build", |s| !s.workbench.builds().is_running()); match state.workbench.builds().last("fivem") { @@ -207,7 +207,7 @@ fn a_project_reopens_on_the_workspace_it_was_left_on_and_writes_nothing_before_a ); drop(state); - let mut again = super::AppState::from_prefs(super::Prefs::default()); + let mut again = crate::state::AppState::from_prefs(crate::state::Prefs::default()); again.documents.clear(); again.load_project_from(file); assert_eq!(again.active_workspace, other); @@ -245,7 +245,7 @@ fn a_member_source_folder_that_moved_is_followed_by_its_id_and_a_path_alone_is_s std::fs::create_dir_all(moved.parent().unwrap()).unwrap(); std::fs::rename(&source, &moved).unwrap(); - let mut again = super::AppState::from_prefs(super::Prefs::default()); + let mut again = crate::state::AppState::from_prefs(crate::state::Prefs::default()); again.documents.clear(); again.load_project_from(file.clone()); until(&mut again, "the member to be followed", |s| { @@ -288,8 +288,8 @@ const C: &str = "mp_m_freemode_01_mp_m_t"; #[test] fn a_dropped_folder_that_holds_content_proposes_that_content_and_each_answer_does_what_it_says() { - use super::workbench::Question; use crate::state::os_drop::DropTarget; + use crate::state::workbench::Question; let dir = tempfile::tempdir().unwrap(); let (mut state, _) = a_buildable_project(dir.path()); let modules = state.project_carried.container.modules.len(); @@ -343,8 +343,8 @@ fn a_dropped_folder_that_holds_content_proposes_that_content_and_each_answer_doe #[test] fn a_dropped_folder_of_clothes_asks_whether_to_make_clothing_as_the_files_of_the_drop_do() { - use super::workbench::Question; use crate::state::os_drop::DropTarget; + use crate::state::workbench::Question; let dir = tempfile::tempdir().unwrap(); let (mut state, _) = a_buildable_project(dir.path()); assert!(!state.has_clothing()); @@ -380,7 +380,7 @@ fn a_second_window_on_a_project_another_holds_is_told_so_and_changes_nothing_of_ ); let folder = file.parent().unwrap().to_path_buf(); - let mut second = super::AppState::from_prefs(super::Prefs::default()); + let mut second = crate::state::AppState::from_prefs(crate::state::Prefs::default()); second.documents.clear(); second.load_project_from(file.clone()); let why = second @@ -426,7 +426,7 @@ fn a_second_window_on_a_project_another_holds_is_told_so_and_changes_nothing_of_ // The first window lets go, and a window opened after it writes. drop(first); - let mut third = super::AppState::from_prefs(super::Prefs::default()); + let mut third = crate::state::AppState::from_prefs(crate::state::Prefs::default()); third.documents.clear(); third.load_project_from(file); assert!( @@ -440,11 +440,11 @@ fn the_sample_project_is_made_of_synthetic_content_opens_with_a_problem_to_find_ let dir = tempfile::tempdir().unwrap(); let root = dir.path().join("sample"); - let file = super::AppState::make_sample_project(&root).expect("the sample is made"); + let file = crate::state::AppState::make_sample_project(&root).expect("the sample is made"); assert!(file.is_file() && file.starts_with(&root), "{file:?}"); let written = std::fs::read(&file).unwrap(); - let mut state = super::AppState::from_prefs(super::Prefs::default()); + let mut state = crate::state::AppState::from_prefs(crate::state::Prefs::default()); state.documents.clear(); state.load_project_from(file.clone()); until(&mut state, "the garments", |s| { @@ -465,13 +465,16 @@ fn the_sample_project_is_made_of_synthetic_content_opens_with_a_problem_to_find_ ); // Made once: a second call finds it and writes nothing. - assert_eq!(super::AppState::make_sample_project(&root).unwrap(), file); + assert_eq!( + crate::state::AppState::make_sample_project(&root).unwrap(), + file + ); assert_eq!(std::fs::read(&file).unwrap(), written); } #[test] fn the_tour_walks_the_screens_one_step_at_a_time_and_ends_on_the_guide() { - let mut state = super::AppState::from_prefs(super::Prefs::default()); + let mut state = crate::state::AppState::from_prefs(crate::state::Prefs::default()); assert!(state.front_door.tour.is_none()); state.start_tour(); assert_eq!(state.front_door.tour, Some(0)); @@ -482,13 +485,13 @@ fn the_tour_walks_the_screens_one_step_at_a_time_and_ends_on_the_guide() { "there is nothing before the first step" ); - let steps = super::front_door::TOUR.len(); + let steps = crate::state::front_door::TOUR.len(); assert!(steps >= 4, "a tour of the screens that matter"); for at in 0..steps { assert_eq!(state.front_door.tour, Some(at)); assert_eq!( state.active_workspace, - super::front_door::TOUR[at].workspace, + crate::state::front_door::TOUR[at].workspace, "each step shows its screen" ); state.tour_next(); diff --git a/src/state/the_project_screens.rs b/src/state/tests/the_project_screens.rs similarity index 97% rename from src/state/the_project_screens.rs rename to src/state/tests/the_project_screens.rs index 02951a9ff..8440f8e1d 100644 --- a/src/state/the_project_screens.rs +++ b/src/state/tests/the_project_screens.rs @@ -8,7 +8,7 @@ use std::path::{Path, PathBuf}; use or_project::{Container, Output, Project}; -use super::{AppState, Prefs}; +use crate::state::{AppState, Prefs}; fn write(path: &Path, body: &[u8]) -> PathBuf { std::fs::create_dir_all(path.parent().unwrap()).unwrap(); @@ -39,7 +39,7 @@ fn files_project(dir: &Path, members: &[PathBuf]) -> (AppState, PathBuf) { #[test] fn a_clean_removes_exactly_what_its_question_counted() { - use super::workbench::Question; + use crate::state::workbench::Question; let dir = tempfile::tempdir().unwrap(); let script = write(&dir.path().join("pack/client.lua"), b"print('hello')"); diff --git a/src/state/the_project_workspace.rs b/src/state/tests/the_project_workspace.rs similarity index 91% rename from src/state/the_project_workspace.rs rename to src/state/tests/the_project_workspace.rs index 1712528fc..360e5edd7 100644 --- a/src/state/the_project_workspace.rs +++ b/src/state/tests/the_project_workspace.rs @@ -9,15 +9,15 @@ use std::time::{Duration, Instant}; use or_project::{Container, Output, Project}; -use super::workbench::{AssetRow, AssetState, Kept, Question}; -use super::{AppState, Prefs}; +use crate::state::workbench::{AssetRow, AssetState, Kept, Question}; +use crate::state::{AppState, Prefs}; -pub(super) fn write(path: &Path, body: &[u8]) { +pub(in crate::state) fn write(path: &Path, body: &[u8]) { std::fs::create_dir_all(path.parent().unwrap()).unwrap(); std::fs::write(path, body).unwrap(); } -pub(super) fn png(path: &Path, shade: u8) { +pub(in crate::state) fn png(path: &Path, shade: u8) { std::fs::create_dir_all(path.parent().unwrap()).unwrap(); image::RgbaImage::from_pixel(8, 8, image::Rgba([shade, 0, 0, 255])) .save(path) @@ -49,7 +49,7 @@ fn source(folder: &Path) -> PathBuf { } /// A project of two scripts, a missing file and a source folder, with one build, opened in a state. -pub(super) fn opened(dir: &Path) -> (AppState, PathBuf) { +pub(in crate::state) fn opened(dir: &Path) -> (AppState, PathBuf) { let folder = dir.join("police_pack"); write(&folder.join("client.lua"), b"print('hello')"); write( @@ -80,7 +80,7 @@ pub(super) fn opened(dir: &Path) -> (AppState, PathBuf) { } /// Polls the workbench until `done`, which a worker's answer makes true. -pub(super) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) -> bool) { +pub(in crate::state) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) -> bool) { let deadline = Instant::now() + Duration::from_secs(30); loop { state.poll_workbench(); @@ -92,7 +92,7 @@ pub(super) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) - } } -pub(super) fn row<'a>(state: &'a AppState, name: &str) -> &'a AssetRow { +pub(in crate::state) fn row<'a>(state: &'a AppState, name: &str) -> &'a AssetRow { state .workbench .rows() diff --git a/src/state/the_rules_of_a_pack_are_set_and_its_problems_written_out_from_the_app.rs b/src/state/tests/the_rules_of_a_pack_are_set_and_its_problems_written_out_from_the_app.rs similarity index 97% rename from src/state/the_rules_of_a_pack_are_set_and_its_problems_written_out_from_the_app.rs rename to src/state/tests/the_rules_of_a_pack_are_set_and_its_problems_written_out_from_the_app.rs index 3b8cbb0b8..9ea9d0ccb 100644 --- a/src/state/the_rules_of_a_pack_are_set_and_its_problems_written_out_from_the_app.rs +++ b/src/state/tests/the_rules_of_a_pack_are_set_and_its_problems_written_out_from_the_app.rs @@ -9,9 +9,11 @@ use std::path::Path; use or_wardrobe::Wardrobe; use super::the_wardrobe_workspace::{drop_files, garments, opened, until, C}; -use super::workbench::{ProblemFormat, ProblemGroup, ProblemShow, ProblemView, Question, Severity}; -use super::AppState; use crate::platform::file_dialogs; +use crate::state::workbench::{ + ProblemFormat, ProblemGroup, ProblemShow, ProblemView, Question, Severity, +}; +use crate::state::AppState; /// Two jackets of one model, which is what the rule of duplicates finds. fn two_of_one_jacket(dir: &Path) -> Vec { diff --git a/src/state/the_shells_regions.rs b/src/state/tests/the_shells_regions.rs similarity index 98% rename from src/state/the_shells_regions.rs rename to src/state/tests/the_shells_regions.rs index c09687084..d6196aab7 100644 --- a/src/state/the_shells_regions.rs +++ b/src/state/tests/the_shells_regions.rs @@ -1,8 +1,8 @@ //! One job per region: Files and the Outline on the left, the document in the //! centre, the Inspector on the right. -use super::{AppState, DocumentId, DocumentKind, Prefs}; use crate::state::panel_ids as ids; +use crate::state::{AppState, DocumentId, DocumentKind, Prefs}; /// Every labelled widget one frame of the tab strip and the dock lays out, and its centre. fn frame( diff --git a/src/state/the_skeleton_files_own_model_can_be_hidden.rs b/src/state/tests/the_skeleton_files_own_model_can_be_hidden.rs similarity index 99% rename from src/state/the_skeleton_files_own_model_can_be_hidden.rs rename to src/state/tests/the_skeleton_files_own_model_can_be_hidden.rs index 502e5851f..92aa6dfa0 100644 --- a/src/state/the_skeleton_files_own_model_can_be_hidden.rs +++ b/src/state/tests/the_skeleton_files_own_model_can_be_hidden.rs @@ -7,14 +7,14 @@ use or_io::gta5::GtaDrawable; use or_test_support::{skip_corpus, Corpus}; use super::an_edit_stays_where_it_was_made::open; -use super::prefs::{keep_prefs_in, load_prefs, Prefs}; use super::the_animation_preview_draws_what_its_sources_hold::{a_clip_over_the_rig, rigged, CLIP}; use super::the_viewport_picks_what_it_draws::{a_triangle, Holder}; -use super::{AppState, DocPayload, DocumentId, MeshSource, SkeletonSource}; use crate::render::meshes::build_meshes_for_active_document; use crate::render::skeleton_lines::build_pose_comparison; use crate::render::viewport::MeshCacheKey; +use crate::state::prefs::{keep_prefs_in, load_prefs, Prefs}; use crate::state::Workspace; +use crate::state::{AppState, DocPayload, DocumentId, MeshSource, SkeletonSource}; use crate::ui::panels::viewport::layout::overlay_text; const THE_BOX: &str = "Draw the skeleton file's own model"; diff --git a/src/state/the_two_paths_of_the_workbench_end_to_end.rs b/src/state/tests/the_two_paths_of_the_workbench_end_to_end.rs similarity index 98% rename from src/state/the_two_paths_of_the_workbench_end_to_end.rs rename to src/state/tests/the_two_paths_of_the_workbench_end_to_end.rs index e7b386770..e82ff2843 100644 --- a/src/state/the_two_paths_of_the_workbench_end_to_end.rs +++ b/src/state/tests/the_two_paths_of_the_workbench_end_to_end.rs @@ -13,14 +13,14 @@ use or_wardrobe::measure::{measure, Measure}; use or_wardrobe::Wardrobe; use super::fix_all_safe_and_the_optimiser_in_the_app::ytd; -use super::front_door::{NewProject, Template}; use super::importing_game_files_from_the_app::{imported, row}; use super::opening_a_ydd::finish_load; -use super::os_drop::DropTarget; use super::the_dressed_ped::until; -use super::workbench::{AssetState, LastBuild}; -use super::{AppState, DocumentKind, Prefs}; +use crate::state::front_door::{NewProject, Template}; +use crate::state::os_drop::DropTarget; +use crate::state::workbench::{AssetState, LastBuild}; use crate::state::Workspace; +use crate::state::{AppState, DocumentKind, Prefs}; use crate::ui::commands::{self, Action}; const WHAT: &str = "the_two_paths_of_the_workbench_end_to_end"; diff --git a/src/state/the_unsaved_marker_tells_the_truth.rs b/src/state/tests/the_unsaved_marker_tells_the_truth.rs similarity index 92% rename from src/state/the_unsaved_marker_tells_the_truth.rs rename to src/state/tests/the_unsaved_marker_tells_the_truth.rs index 3f2b2054a..c8c32e17a 100644 --- a/src/state/the_unsaved_marker_tells_the_truth.rs +++ b/src/state/tests/the_unsaved_marker_tells_the_truth.rs @@ -6,8 +6,8 @@ use std::path::PathBuf; -use super::texture_resolution::AttachedDictionary; -use super::{AppState, CloseAnswer, DocPayload, Document, DocumentId}; +use crate::state::texture_resolution::AttachedDictionary; +use crate::state::{AppState, CloseAnswer, DocPayload, Document, DocumentId}; /// What the tab strip, the status bar and the hierarchy mark `doc` with. fn marked(state: &AppState, doc: DocumentId) -> bool { diff --git a/src/state/the_viewport_draws_every_edit.rs b/src/state/tests/the_viewport_draws_every_edit.rs similarity index 96% rename from src/state/the_viewport_draws_every_edit.rs rename to src/state/tests/the_viewport_draws_every_edit.rs index 1e06cfd19..eeb2a6cce 100644 --- a/src/state/the_viewport_draws_every_edit.rs +++ b/src/state/tests/the_viewport_draws_every_edit.rs @@ -7,10 +7,10 @@ use or_test_support::skip_corpus; use super::an_edit_stays_where_it_was_made::{ drawable_with_a_material, edit_a_material, grid_row, open, }; -use super::document_io::empty_file_bytes_for_kind; -use super::{AppState, DocPayload, DocumentId, DocumentKind, SelectionKey}; use crate::render::thumbnails::ThumbKey; use crate::render::viewport::{LinesCacheKey, MeshCacheKey}; +use crate::state::document_io::empty_file_bytes_for_kind; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind, SelectionKey}; type Keys = (MeshCacheKey, LinesCacheKey, ThumbKey); diff --git a/src/state/the_viewport_picks_every_line_it_draws.rs b/src/state/tests/the_viewport_picks_every_line_it_draws.rs similarity index 99% rename from src/state/the_viewport_picks_every_line_it_draws.rs rename to src/state/tests/the_viewport_picks_every_line_it_draws.rs index 448e80f1b..b0d9f043f 100644 --- a/src/state/the_viewport_picks_every_line_it_draws.rs +++ b/src/state/tests/the_viewport_picks_every_line_it_draws.rs @@ -9,7 +9,6 @@ use or_io::gta5::{ }; use or_renderer::ShadingMode; -use super::prefs::Prefs; use super::the_animation_preview_draws_what_its_sources_hold::CLIP; use super::the_viewport_picks_what_it_draws::{ a_fragment, click_on_the_sphere, embedding_nested_bounds, picked, previewing, ray, @@ -18,11 +17,12 @@ use super::the_viewport_picks_what_it_draws::{ use super::viewport_basics_for_inspecting_assets::{ the_outline_rows_labelled, the_outline_selects, the_outline_shows, }; -use super::{AppState, DictPart, DocPayload, MeshSource, SelectionKey}; use crate::render::bound_meshes::shapes::{box_bound, composite, sphere}; use crate::render::viewport::pick::{select_under, Ray}; +use crate::state::prefs::Prefs; use crate::state::selection_lookup::physics_bound_hash; use crate::state::Workspace; +use crate::state::{AppState, DictPart, DocPayload, MeshSource, SelectionKey}; fn the_ghost_of() { for holder in Holder::ALL { diff --git a/src/state/the_viewport_picks_what_it_draws.rs b/src/state/tests/the_viewport_picks_what_it_draws.rs similarity index 89% rename from src/state/the_viewport_picks_what_it_draws.rs rename to src/state/tests/the_viewport_picks_what_it_draws.rs index 3c91b7f2e..84e284793 100644 --- a/src/state/the_viewport_picks_what_it_draws.rs +++ b/src/state/tests/the_viewport_picks_what_it_draws.rs @@ -12,30 +12,32 @@ use or_io::gta5::{ }; use or_renderer::OrbitCamera; -use super::prefs::Prefs; -use super::textures::FRAGMENT_ENTRY_HASH; use super::the_animation_preview_draws_what_its_sources_hold::{a_clip_over_the_rig, rigged, CLIP}; use super::viewport_basics_for_inspecting_assets::the_outline_shows; -use super::{AppState, DictPart, DocPayload, DocumentId, MeshSource, SelectionKey, SkeletonSource}; use crate::render::bound_meshes::shapes::{box_bound, composite, sphere}; use crate::render::viewport::pick::{select_under, Ray}; +use crate::state::prefs::Prefs; +use crate::state::textures::FRAGMENT_ENTRY_HASH; use crate::state::Workspace; +use crate::state::{ + AppState, DictPart, DocPayload, DocumentId, MeshSource, SelectionKey, SkeletonSource, +}; /// The hash a dictionary here holds its one entry under. -pub(super) const HASH: u32 = 0x1234_5678; +pub(in crate::state) const HASH: u32 = 0x1234_5678; /// Every bone moved straight up and far, so no ray towards a face where the bind pose put it meets /// the moved mesh. -pub(super) const MOVED: Vec3 = Vec3::new(0.0, 0.0, 1000.0); +pub(in crate::state) const MOVED: Vec3 = Vec3::new(0.0, 0.0, 1000.0); /// What a target's drawable, dictionary and fragment become as an asset. -pub(super) trait Held: DrawableTarget + Sized { +pub(in crate::state) trait Held: DrawableTarget + Sized { fn drawable(drawable: GtaDrawable) -> or_io::Asset; fn dictionary(drawable: GtaDrawable) -> or_io::Asset; fn fragment(drawable: GtaDrawable) -> or_io::Asset; } -pub(super) fn one_entry( +pub(in crate::state) fn one_entry( drawable: GtaDrawable, ) -> PgDictionary> { PgDictionary { @@ -47,7 +49,7 @@ pub(super) fn one_entry( // The struct update the lint asks for does not compile: the fragment holds private fields. #[allow(clippy::field_reassign_with_default)] -pub(super) fn a_fragment(drawable: GtaDrawable) -> GtaFragType { +pub(in crate::state) fn a_fragment(drawable: GtaDrawable) -> GtaFragType { let mut common = FragDrawable::::default(); common.base = drawable.base; let mut fragment = GtaFragType::::default(); @@ -81,16 +83,16 @@ impl Held for Gen9 { /// How a drawable is held: by itself, as the one entry of a dictionary, or as a fragment's own. #[derive(Clone, Copy, Debug)] -pub(super) enum Holder { +pub(in crate::state) enum Holder { Drawable, Entry, Fragment, } impl Holder { - pub(super) const ALL: [Self; 3] = [Self::Drawable, Self::Entry, Self::Fragment]; + pub(in crate::state) const ALL: [Self; 3] = [Self::Drawable, Self::Entry, Self::Fragment]; - pub(super) fn asset(self, drawable: GtaDrawable) -> or_io::Asset { + pub(in crate::state) fn asset(self, drawable: GtaDrawable) -> or_io::Asset { match self { Self::Drawable => T::drawable(drawable), Self::Entry => T::dictionary(drawable), @@ -98,7 +100,7 @@ impl Holder { } } - pub(super) fn file(self) -> &'static str { + pub(in crate::state) fn file(self) -> &'static str { match self { Self::Drawable => "C:/mods/held.ydr", Self::Entry => "C:/mods/held.ydd", @@ -116,7 +118,7 @@ impl Holder { } /// The row the Outline gives bone `bone`. - pub(super) fn bone(self, bone: u32) -> SelectionKey { + pub(in crate::state) fn bone(self, bone: u32) -> SelectionKey { match self.hash() { None => SelectionKey::Skeleton(bone), Some(hash) => SelectionKey::dict_part(hash, DictPart::Bone(bone)), @@ -124,7 +126,7 @@ impl Holder { } /// The row the Outline gives the geometry `geometry` of the first model of the first level. - pub(super) fn geometry(self, geometry: u32) -> SelectionKey { + pub(in crate::state) fn geometry(self, geometry: u32) -> SelectionKey { match self.hash() { None => SelectionKey::Lod { lod: 0, @@ -143,7 +145,7 @@ impl Holder { } /// The row the Outline gives the first model of the first level. - pub(super) fn model(self) -> SelectionKey { + pub(in crate::state) fn model(self) -> SelectionKey { match self.hash() { None => SelectionKey::Lod { lod: 0, @@ -162,7 +164,7 @@ impl Holder { } /// The row the Outline gives the bound's node `node`: an entry has the one. - pub(super) fn bound(self, node: u32) -> SelectionKey { + pub(in crate::state) fn bound(self, node: u32) -> SelectionKey { match self.hash() { None => SelectionKey::Bound(node), Some(hash) => SelectionKey::dict_part(hash, DictPart::Bound(0)), @@ -170,7 +172,7 @@ impl Holder { } /// The skeleton source this holder makes of the document that holds the drawable. - pub(super) fn skeleton(self, doc: DocumentId) -> SkeletonSource { + pub(in crate::state) fn skeleton(self, doc: DocumentId) -> SkeletonSource { match self { Self::Drawable => SkeletonSource::Drawable(doc), Self::Entry => SkeletonSource::DictionaryEntry(doc, 0), @@ -179,7 +181,7 @@ impl Holder { } /// The mesh source this holder makes of the document that holds the drawable. - pub(super) fn mesh(self, doc: DocumentId) -> MeshSource { + pub(in crate::state) fn mesh(self, doc: DocumentId) -> MeshSource { MeshSource { document: doc, entry: matches!(self, Self::Entry).then_some(0), @@ -188,7 +190,7 @@ impl Holder { } /// A camera `distance` from `at` towards `from`, a unit vector, looking at it. -pub(super) fn camera(at: Vec3, from: Vec3, distance: f32) -> OrbitCamera { +pub(in crate::state) fn camera(at: Vec3, from: Vec3, distance: f32) -> OrbitCamera { OrbitCamera { target: at, yaw: from.y.atan2(from.x), @@ -200,7 +202,7 @@ pub(super) fn camera(at: Vec3, from: Vec3, distance: f32) -> OrbitCamera { /// A ray through the middle of a viewport, as if it were `distance` from `at` towards `from` (a /// unit vector), moved `shift` points over the screen. -pub(super) fn ray(at: Vec3, from: Vec3, distance: f32, shift: egui::Vec2) -> Ray { +pub(in crate::state) fn ray(at: Vec3, from: Vec3, distance: f32, shift: egui::Vec2) -> Ray { let camera = camera(at, from, distance); let rect = egui::Rect::from_min_size(egui::pos2(300.0, 40.0), egui::vec2(800.0, 500.0)); Ray::at(&camera, rect, (1200, 750), rect.center() + shift).expect("a ray") @@ -259,7 +261,7 @@ fn triangle(corners: [[f32; 3]; 3], bone: Option) -> GrmGeometry { /// A Legacy drawable of one triangle, with `bound` embedded where there is one. // The struct update the lint asks for does not compile: the drawable holds private fields. #[allow(clippy::field_reassign_with_default)] -pub(super) fn a_triangle( +pub(in crate::state) fn a_triangle( corners: [[f32; 3]; 3], bone: Option, bound: Option, @@ -290,7 +292,7 @@ pub(super) fn a_triangle( /// A drawable of target `T` embedding a composite of a composite and a box, the inner one holding a /// box and then a sphere five metres along x, so the nodes number root 0, inner 1, box 2, sphere 3, box 4. #[allow(clippy::field_reassign_with_default)] -pub(super) fn embedding_nested_bounds() -> GtaDrawable { +pub(in crate::state) fn embedding_nested_bounds() -> GtaDrawable { let mut drawable = GtaDrawable::::default(); let inner = composite(vec![ box_bound([0.0; 3], [1.0; 3]), @@ -303,14 +305,14 @@ pub(super) fn embedding_nested_bounds() -> GtaDrawable { /// The Animation workspace previewing `rig` against a clip dictionary, with the bones shown and /// the clip evaluated; the clip dictionary is the active document. -pub(super) struct Preview { - pub(super) state: AppState, +pub(in crate::state) struct Preview { + pub(in crate::state) state: AppState, /// The document that holds the rig. - pub(super) rig: DocumentId, - pub(super) clips: DocumentId, + pub(in crate::state) rig: DocumentId, + pub(in crate::state) clips: DocumentId, } -pub(super) fn previewing(holder: Holder) -> Preview { +pub(in crate::state) fn previewing(holder: Holder) -> Preview { let mut state = AppState::from_prefs(Prefs::default()); let rig = state.insert_document( holder.file().into(), @@ -330,7 +332,7 @@ pub(super) fn previewing(holder: Holder) -> Preview { } /// The middle of the rig's second bone, whose segment runs from the root at y = 1 to y = 2. -pub(super) const MIDDLE_OF_THE_BONE: Vec3 = Vec3::new(0.0, 1.5, 0.0); +pub(in crate::state) const MIDDLE_OF_THE_BONE: Vec3 = Vec3::new(0.0, 1.5, 0.0); fn bones_of() { for holder in Holder::ALL { @@ -384,13 +386,13 @@ fn a_click_on_a_bone_selects_its_row_in_the_outline() { } /// What the Animation preview says was picked, and in which document. -pub(super) fn picked(state: &AppState) -> Option<(DocumentId, &str)> { +pub(in crate::state) fn picked(state: &AppState) -> Option<(DocumentId, &str)> { let picked = state.preview_scene.picked.as_ref()?; Some((picked.document, picked.label.as_str())) } /// A click on the sphere, at a point on two of its circles. -pub(super) fn click_on_the_sphere() -> Ray { +pub(in crate::state) fn click_on_the_sphere() -> Ray { let from = Vec3::new(0.3, -1.0, 0.6).normalize(); ray(Vec3::new(6.0, 0.0, 0.0), from, 10.0, egui::Vec2::ZERO) } @@ -438,13 +440,13 @@ fn a_click_on_a_bound_selects_its_row_in_the_outline() { } /// The side the middle of a box's edge at y = -1, z = 1 faces, as a unit vector from it. -pub(super) fn the_side_that_edge_faces() -> Vec3 { +pub(in crate::state) fn the_side_that_edge_faces() -> Vec3 { Vec3::new(0.35, -1.0, 1.0).normalize() } /// The Animation workspace over a clip dictionary, with the triangle drawable held as `holder` /// added as a mesh source, and no skeleton. -pub(super) fn previewing_a_triangle( +pub(in crate::state) fn previewing_a_triangle( holder: Holder, bone: Option, ) -> (AppState, DocumentId, DocumentId) { @@ -510,7 +512,7 @@ fn a_click_reaches_a_mesh_source_drawn_beside_a_clip_dictionary() { } /// A click on the middle of the rig's second bone, seen from the side. -pub(super) fn click_on_the_bone() -> Ray { +pub(in crate::state) fn click_on_the_bone() -> Ray { ray(MIDDLE_OF_THE_BONE, Vec3::X, 2.0, egui::Vec2::ZERO) } diff --git a/src/state/the_wardrobe_edit_operations.rs b/src/state/tests/the_wardrobe_edit_operations.rs similarity index 99% rename from src/state/the_wardrobe_edit_operations.rs rename to src/state/tests/the_wardrobe_edit_operations.rs index 5c6bc33b8..5b396955c 100644 --- a/src/state/the_wardrobe_edit_operations.rs +++ b/src/state/tests/the_wardrobe_edit_operations.rs @@ -10,7 +10,7 @@ use std::path::{Path, PathBuf}; use or_wardrobe::Wardrobe; use super::the_wardrobe_workspace::{drop_files, garments, opened, until, C}; -use super::AppState; +use crate::state::AppState; fn idle(state: &mut AppState, what: &str) { until(state, what, |s| s.workbench.wardrobe.is_idle()); diff --git a/src/state/the_wardrobe_import_breadth.rs b/src/state/tests/the_wardrobe_import_breadth.rs similarity index 99% rename from src/state/the_wardrobe_import_breadth.rs rename to src/state/tests/the_wardrobe_import_breadth.rs index 2c7c3b8c7..6681f2ea9 100644 --- a/src/state/the_wardrobe_import_breadth.rs +++ b/src/state/tests/the_wardrobe_import_breadth.rs @@ -9,7 +9,7 @@ use std::path::{Path, PathBuf}; use or_wardrobe::{Component, Ped, Slot, Wardrobe}; use super::the_wardrobe_workspace::{drop_files, garments, opened, until, write, C}; -use super::AppState; +use crate::state::AppState; fn idle(state: &mut AppState, what: &str) { until(state, what, |s| s.workbench.wardrobe.is_idle()); diff --git a/src/state/the_wardrobe_workspace.rs b/src/state/tests/the_wardrobe_workspace.rs similarity index 94% rename from src/state/the_wardrobe_workspace.rs rename to src/state/tests/the_wardrobe_workspace.rs index c3d865639..4c3c823f9 100644 --- a/src/state/the_wardrobe_workspace.rs +++ b/src/state/tests/the_wardrobe_workspace.rs @@ -10,20 +10,20 @@ use std::time::{Duration, Instant}; use or_project::Module; use or_wardrobe::edit::Edit; -use super::front_door::{NewProject, Template}; -use super::workbench::Place; -use super::{AppState, Prefs}; +use crate::state::front_door::{NewProject, Template}; +use crate::state::workbench::Place; +use crate::state::{AppState, Prefs}; -pub(super) const C: &str = "mp_m_freemode_01_mp_m_t"; +pub(in crate::state) const C: &str = "mp_m_freemode_01_mp_m_t"; -pub(super) fn write(path: &Path, body: &[u8]) -> PathBuf { +pub(in crate::state) fn write(path: &Path, body: &[u8]) -> PathBuf { std::fs::create_dir_all(path.parent().unwrap()).unwrap(); std::fs::write(path, body).unwrap(); path.to_path_buf() } /// A state with nothing open, as `from_prefs` makes one. -pub(super) fn bare() -> AppState { +pub(in crate::state) fn bare() -> AppState { let mut state = AppState::from_prefs(Prefs::default()); state.documents.clear(); state.active_document = None; @@ -31,7 +31,7 @@ pub(super) fn bare() -> AppState { } /// A clothing project made the way the template makes it, opened in a state. -pub(super) fn opened(dir: &Path) -> (AppState, PathBuf) { +pub(in crate::state) fn opened(dir: &Path) -> (AppState, PathBuf) { let mut draft = NewProject::new(Template::Clothing, dir.to_path_buf()); draft.set_name("tshirts".into()); let created = draft.create().expect("the template makes a project"); @@ -41,7 +41,7 @@ pub(super) fn opened(dir: &Path) -> (AppState, PathBuf) { } /// Polls the workbench until `done`, which a worker's answer makes true. -pub(super) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) -> bool) { +pub(in crate::state) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) -> bool) { let deadline = Instant::now() + Duration::from_secs(30); loop { state.poll_workbench(); @@ -54,14 +54,14 @@ pub(super) fn until(state: &mut AppState, what: &str, done: impl Fn(&AppState) - } /// The garments of the content shown, as the last scan read them. -pub(super) fn garments(state: &AppState) -> usize { +pub(in crate::state) fn garments(state: &AppState) -> usize { state .wardrobe_pack() .and_then(|p| p.read.as_ref().ok()) .map_or(0, |read| read.wardrobe.garments.len()) } -pub(super) use super::dropped_files::drop_files; +pub(in crate::state) use super::dropped_files::drop_files; /// Every file under `dir` with the bytes it holds, to say that nothing was written there. fn held(dir: &Path) -> std::collections::BTreeMap> { @@ -232,7 +232,7 @@ fn a_linked_pack_is_shown_in_the_wardrobe_and_every_edit_of_it_is_refused_naming #[test] fn a_card_counts_the_garments_of_a_clothing_pack_and_a_pack_that_cannot_be_read_is_clothing_without_a_count( ) { - use super::front_door::cards::read_card; + use crate::state::front_door::cards::read_card; let dir = tempfile::tempdir().unwrap(); let mut draft = NewProject::new(Template::Clothing, dir.path().to_path_buf()); draft.set_name("harbor".into()); diff --git a/src/state/the_world_screen_adds_and_copies.rs b/src/state/tests/the_world_screen_adds_and_copies.rs similarity index 98% rename from src/state/the_world_screen_adds_and_copies.rs rename to src/state/tests/the_world_screen_adds_and_copies.rs index 9a9a7d3e7..124d36d73 100644 --- a/src/state/the_world_screen_adds_and_copies.rs +++ b/src/state/tests/the_world_screen_adds_and_copies.rs @@ -19,10 +19,10 @@ use super::the_map_screen_holds_a_session::{said, save}; use super::the_world_screen_edits_a_project::{ click, errors, pack, places, rested, session, stands_at, undo, world, }; -use super::workbench::{pose_of_picked, COPY_ASIDE}; -use super::world_session::tests::{answered, CHILD_MIDDLE}; -use super::world_session::{Picking, Selection}; -use super::{AppState, ToastType}; +use crate::state::workbench::{pose_of_picked, COPY_ASIDE}; +use crate::state::world_session::tests::{answered, CHILD_MIDDLE}; +use crate::state::world_session::{Picking, Selection}; +use crate::state::{AppState, ToastType}; use crate::ui::commands::{self, Action}; const ASPECT: f32 = 4.0 / 3.0; diff --git a/src/state/the_world_screen_edits_a_project.rs b/src/state/tests/the_world_screen_edits_a_project.rs similarity index 89% rename from src/state/the_world_screen_edits_a_project.rs rename to src/state/tests/the_world_screen_edits_a_project.rs index f5015c67b..0c9b3c68c 100644 --- a/src/state/the_world_screen_edits_a_project.rs +++ b/src/state/tests/the_world_screen_edits_a_project.rs @@ -10,23 +10,26 @@ use std::sync::Arc; use glam::Vec3; use or_maps::changes::{source_changes, EntityChange, SourceChanges}; -use super::front_door::{NewProject, Template}; use super::the_map_screen_holds_a_session::{said, save, sources}; use super::the_wardrobe_workspace::bare; -use super::workbench::pose_of_picked; -use super::world_session::tests::{ +use crate::state::front_door::{NewProject, Template}; +use crate::state::workbench::pose_of_picked; +use crate::state::world_session::tests::{ answered, at_rest, over_the_child, seen_at, Device, CHILD_MIDDLE, }; -use super::world_session::{ray_through, Picking, Selection, WorldSession}; -use super::{AppState, ToastType}; +use crate::state::world_session::{ray_through, Picking, Selection, WorldSession}; use crate::state::Workspace; +use crate::state::{AppState, ToastType}; use crate::ui::commands::{self, Action}; use or_world::pick::Picked; const ASPECT: f32 = 4.0 / 3.0; /// The app with the hand-built install's world open and at rest over the first child, on the World screen; with a project of one empty maps content where `with_project`. -pub(super) fn world(dir: &Path, with_project: bool) -> (AppState, [tempfile::TempDir; 2]) { +pub(in crate::state) fn world( + dir: &Path, + with_project: bool, +) -> (AppState, [tempfile::TempDir; 2]) { let project = with_project.then(|| { let mut draft = NewProject::new(Template::Maps, dir.to_path_buf()); draft.set_name("city".into()); @@ -36,7 +39,7 @@ pub(super) fn world(dir: &Path, with_project: bool) -> (AppState, [tempfile::Tem } /// [`world`], over the project at `project` where one is given. -pub(super) fn world_over(project: Option) -> (AppState, [tempfile::TempDir; 2]) { +pub(in crate::state) fn world_over(project: Option) -> (AppState, [tempfile::TempDir; 2]) { let (session, key, folders) = over_the_child(); let mut state = bare(); if let Some(project) = project { @@ -49,18 +52,18 @@ pub(super) fn world_over(project: Option) -> (AppState, [tempfile::Temp (state, folders) } -pub(super) fn session(state: &mut AppState) -> &mut dyn WorldSession { +pub(in crate::state) fn session(state: &mut AppState) -> &mut dyn WorldSession { state.world.session().expect("the session is held") } /// The session at rest with its camera where it stands, and what it then hands a frame. -pub(super) fn rested(state: &mut AppState) -> Arc { +pub(in crate::state) fn rested(state: &mut AppState) -> Arc { let eye = session(state).camera().position; at_rest(session(state), eye, &mut Device::default()) } /// Click what the view shows at `point` of the world, and what the session answers. -pub(super) fn click(state: &mut AppState, point: Vec3) -> Arc { +pub(in crate::state) fn click(state: &mut AppState, point: Vec3) -> Arc { rested(state); let session = session(state); let (across, down) = seen_at(session, ASPECT, point); @@ -73,25 +76,25 @@ pub(super) fn click(state: &mut AppState, point: Vec3) -> Arc { } /// Where each instance of `selection` stands. -pub(super) fn places(selection: &Selection) -> Vec { +pub(in crate::state) fn places(selection: &Selection) -> Vec { let instances = &selection.instances; (0..instances.len()) .filter_map(|at| instances.position(at)) .collect() } -pub(super) fn stands_at(selection: &Selection, at: Vec3) -> bool { +pub(in crate::state) fn stands_at(selection: &Selection, at: Vec3) -> bool { places(selection) .iter() .any(|place| place.distance(at) < 1e-3) } -pub(super) fn errors(state: &AppState) -> Vec { +pub(in crate::state) fn errors(state: &AppState) -> Vec { said(state, ToastType::Error) } /// The folder of the project's maps content. -pub(super) fn pack(state: &AppState) -> PathBuf { +pub(in crate::state) fn pack(state: &AppState) -> PathBuf { let project = state.project_path.as_ref().expect("a project is open"); let stated = or_maps::store::Project::of(project, state.project_carried.container.clone()); stated @@ -101,14 +104,14 @@ pub(super) fn pack(state: &AppState) -> PathBuf { } /// What the source `name` of the pack changed of the game's file it was made of. -pub(super) fn changes(state: &AppState, name: &str) -> or_maps::changes::MapChanges { +pub(in crate::state) fn changes(state: &AppState, name: &str) -> or_maps::changes::MapChanges { match source_changes(&pack(state).join(name)).expect("the source compares") { SourceChanges::Map(changes) => changes, SourceChanges::Types(_) => panic!("{name} is a map file"), } } -pub(super) fn undo(state: &mut AppState) { +pub(in crate::state) fn undo(state: &mut AppState) { commands::run_action(state, &egui::Context::default(), Action::Undo); } diff --git a/src/state/the_world_screen_has_a_manipulator.rs b/src/state/tests/the_world_screen_has_a_manipulator.rs similarity index 93% rename from src/state/the_world_screen_has_a_manipulator.rs rename to src/state/tests/the_world_screen_has_a_manipulator.rs index e2047b1e4..9f0e90352 100644 --- a/src/state/the_world_screen_has_a_manipulator.rs +++ b/src/state/tests/the_world_screen_has_a_manipulator.rs @@ -10,18 +10,18 @@ use super::the_map_screen_holds_a_session::said; use super::the_world_screen_edits_a_project::{ click, errors, pack, places, rested, session, stands_at, undo, world, }; -use super::world_session::tests::{answered, CHILD_MIDDLE}; -use super::{AppState, ToastType}; +use crate::state::world_session::tests::{answered, CHILD_MIDDLE}; +use crate::state::{AppState, ToastType}; use crate::ui::panels::world_viewer::draw_view; -pub(super) const SIZE: Vec2 = Vec2::new(800.0, 600.0); +pub(in crate::state) const SIZE: Vec2 = Vec2::new(800.0, 600.0); /// Where the first child of the hand-built ladder stands. const STOOD: Vec3 = Vec3::new(150.0, 0.0, 0.0); /// How far a place read back through a pixel may be from the place asked for, in metres. const NEAR: f32 = 0.02; /// One frame of the view over the whole of a window, with `events`. -pub(super) fn frame(ctx: &egui::Context, state: &mut AppState, events: Vec) { +pub(in crate::state) fn frame(ctx: &egui::Context, state: &mut AppState, events: Vec) { let input = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size( egui::Pos2::ZERO, @@ -37,7 +37,7 @@ pub(super) fn frame(ctx: &egui::Context, state: &mut AppState, events: Vec egui::Event { +pub(in crate::state) fn button(at: Vec2, pressed: bool) -> egui::Event { egui::Event::PointerButton { pos: egui::pos2(at.x, at.y), button: egui::PointerButton::Primary, @@ -46,11 +46,11 @@ pub(super) fn button(at: Vec2, pressed: bool) -> egui::Event { } } -pub(super) fn moved(to: Vec2) -> egui::Event { +pub(in crate::state) fn moved(to: Vec2) -> egui::Event { egui::Event::PointerMoved(egui::pos2(to.x, to.y)) } -pub(super) fn key(key: egui::Key) -> egui::Event { +pub(in crate::state) fn key(key: egui::Key) -> egui::Event { egui::Event::Key { key, physical_key: Some(key), @@ -83,7 +83,7 @@ fn shift(state: &mut AppState) -> Option { } /// The app over the hand-built world with a project open, the first child selected and one frame drawn, with the manipulator at it. -pub(super) fn selected( +pub(in crate::state) fn selected( dir: &std::path::Path, ) -> (AppState, egui::Context, Gizmo, [tempfile::TempDir; 2]) { let (mut state, folders) = world(dir, true); diff --git a/src/state/the_world_screen_shows_layers.rs b/src/state/tests/the_world_screen_shows_layers.rs similarity index 98% rename from src/state/the_world_screen_shows_layers.rs rename to src/state/tests/the_world_screen_shows_layers.rs index 793344a3a..3d2d4d286 100644 --- a/src/state/the_world_screen_shows_layers.rs +++ b/src/state/tests/the_world_screen_shows_layers.rs @@ -13,10 +13,10 @@ use or_world_gta5::layers::{MAP_BOXES, ROAD_LINKS, ROAD_NODES}; use super::the_world_screen_edits_a_project::{session, world}; use super::the_world_screen_has_a_manipulator::{button, frame, moved, SIZE}; -use super::world_session::layers::{LayerPicture, SCREEN_MOST}; -use super::world_session::Picking; -use super::AppState; use crate::hand_built::layers::{NODES, REGION}; +use crate::state::world_session::layers::{LayerPicture, SCREEN_MOST}; +use crate::state::world_session::Picking; +use crate::state::AppState; use crate::ui::panels::world_viewer::layers::{ count_line, counts_of, legend_rows, selection_lines, }; diff --git a/src/state/the_world_screen_takes_its_keys_as_commands.rs b/src/state/tests/the_world_screen_takes_its_keys_as_commands.rs similarity index 98% rename from src/state/the_world_screen_takes_its_keys_as_commands.rs rename to src/state/tests/the_world_screen_takes_its_keys_as_commands.rs index 90b315f48..9586d518a 100644 --- a/src/state/the_world_screen_takes_its_keys_as_commands.rs +++ b/src/state/tests/the_world_screen_takes_its_keys_as_commands.rs @@ -8,17 +8,17 @@ use glam::{Vec2, Vec3}; use or_maps::changes::EntityChange; use or_world::gizmo::Mode; -use super::prefs::Game; use super::the_map_screen_holds_a_session::save; use super::the_world_screen_edits_a_project::{ changes, click, errors, rested, session, undo, world, }; use super::the_world_screen_has_a_manipulator::{button, frame, key, moved, selected, SIZE}; -use super::workbench::{pose_of_picked, TypedPose}; -use super::world_session::tests::{answered, seen_at, CHILD_MIDDLE}; -use super::{AppState, Prefs}; use crate::state::panel_ids as ids; +use crate::state::prefs::Game; +use crate::state::workbench::{pose_of_picked, TypedPose}; +use crate::state::world_session::tests::{answered, seen_at, CHILD_MIDDLE}; use crate::state::Workspace; +use crate::state::{AppState, Prefs}; use crate::ui::commands::{self, Action}; use crate::ui::panels::world_viewer::{draw_side, draw_view}; use crate::ui::shortcuts::{self, ShortcutMods}; @@ -232,7 +232,7 @@ fn a_place_and_a_scale_typed_before_one_enter_are_one_step_of_undo_that_holds_bo fn why_a_world_did_not_open_is_said_in_the_language_in_use_with_what_its_reader_named() { use or_world::contract::WorldError; - use super::world_session::Standing; + use crate::state::world_session::Standing; let folders = tempfile::tempdir().expect("a scratch folder"); let mut state = AppState::from_prefs(Prefs::default()); (state.prefs.game_paths).set(Game::GtaVLegacy, Some(folders.path().to_path_buf())); diff --git a/src/state/two_readers_of_one_archive_across_a_save.rs b/src/state/tests/two_readers_of_one_archive_across_a_save.rs similarity index 92% rename from src/state/two_readers_of_one_archive_across_a_save.rs rename to src/state/tests/two_readers_of_one_archive_across_a_save.rs index a1c13712f..b7c44f15a 100644 --- a/src/state/two_readers_of_one_archive_across_a_save.rs +++ b/src/state/tests/two_readers_of_one_archive_across_a_save.rs @@ -5,16 +5,19 @@ use std::path::Path; use or_io::container::rpf::BodyForm; -use super::document::{DocumentId, RpfNodeId, TextDocument}; -use super::extract_job::{ExtractStart, TypeFilter}; use super::nested_archives_survive_a_save::{archive, body, errors, on_disk, save, EDITED}; use super::nothing_extracts_into_an_install::run_to_completion; use super::opening_a_ydd::{finish_load, node_at}; -use super::save_destination::SaveDestination; -use super::{AppState, DocPayload, DocumentKind}; +use crate::state::document::{DocumentId, RpfNodeId, TextDocument}; +use crate::state::extract_job::{ExtractStart, TypeFilter}; +use crate::state::save_destination::SaveDestination; +use crate::state::{AppState, DocPayload, DocumentKind}; /// `archives` written into `root`, opened as an install's tree. -pub(super) fn install(root: &Path, archives: &[(&str, Vec)]) -> (AppState, DocumentId) { +pub(in crate::state) fn install( + root: &Path, + archives: &[(&str, Vec)], +) -> (AppState, DocumentId) { for (name, bytes) in archives { std::fs::write(root.join(name), bytes).expect("the archive is written"); } @@ -30,7 +33,7 @@ pub(super) fn install(root: &Path, archives: &[(&str, Vec)]) -> (AppState, D } /// `entry` edited in its tab and saved back into its archive, which saves that archive alone. -pub(super) fn save_alone(state: &mut AppState, tree: DocumentId, entry: RpfNodeId) { +pub(in crate::state) fn save_alone(state: &mut AppState, tree: DocumentId, entry: RpfNodeId) { state.open_rpf_entry(tree, entry); let tab = finish_load(state).expect("the entry opens"); let edited = state.document_mut(tab).expect("the entry's tab"); diff --git a/src/state/undo_and_the_sliders_follow_the_pinned_inspector.rs b/src/state/tests/undo_and_the_sliders_follow_the_pinned_inspector.rs similarity index 97% rename from src/state/undo_and_the_sliders_follow_the_pinned_inspector.rs rename to src/state/tests/undo_and_the_sliders_follow_the_pinned_inspector.rs index 1679a4da9..b11df57ce 100644 --- a/src/state/undo_and_the_sliders_follow_the_pinned_inspector.rs +++ b/src/state/tests/undo_and_the_sliders_follow_the_pinned_inspector.rs @@ -9,8 +9,8 @@ use or_test_support::{skip_corpus, Corpus, TARGET_GEN8}; use winit::keyboard::{Key, KeyCode, PhysicalKey}; use super::an_edit_stays_where_it_was_made::{open, texts, Inspector}; -use super::{AppState, DocPayload, DocumentId, DocumentKind, SelectionKey}; use crate::state::panel_ids as ids; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind, SelectionKey}; use crate::ui::commands; use crate::ui::panels::inspector::{self, ypt_steps, InspectorUiState}; use crate::ui::shortcuts; @@ -194,7 +194,8 @@ fn a_clip_dictionary_shows_its_declared_structure_under_its_summary() { state.selection.clear_all(); let structure = { let document = state.document(doc).expect("open"); - let (_, root) = super::described_root(document).expect("a clip dictionary is declared"); + let (_, root) = + crate::state::described_root(document).expect("a clip dictionary is declared"); inspector::summary_at(document, &root, 0).expect("its root is described") }; diff --git a/src/state/undo_from_files_acts_on_what_files_shows.rs b/src/state/tests/undo_from_files_acts_on_what_files_shows.rs similarity index 94% rename from src/state/undo_from_files_acts_on_what_files_shows.rs rename to src/state/tests/undo_from_files_acts_on_what_files_shows.rs index d3dbb1200..0597d5f04 100644 --- a/src/state/undo_from_files_acts_on_what_files_shows.rs +++ b/src/state/tests/undo_from_files_acts_on_what_files_shows.rs @@ -7,13 +7,13 @@ use winit::keyboard::{Key, KeyCode, ModifiersState, NamedKey, PhysicalKey}; use super::destructive_file_operations_ask::node_at; use super::every_edit_undoes::{drawable, float_field}; -use super::navigation::Location; use super::the_files_view_in_the_centre::{ accessible, click, click_with, find, frame, leaf_of, settled, submenu, }; -use super::{AppState, DocPayload, DocumentId, DocumentKind, Prefs, RpfNodeId}; +use crate::state::navigation::Location; use crate::state::panel_ids as ids; use crate::state::Workspace; +use crate::state::{AppState, DocPayload, DocumentId, DocumentKind, Prefs, RpfNodeId}; use crate::ui::commands; use crate::ui::shortcuts; @@ -25,7 +25,7 @@ fn press(state: &mut AppState, ctx: &egui::Context, key: Key, code: KeyCode, mod commands::run_action(state, ctx, action); } -pub(super) fn ctrl_z(state: &mut AppState, ctx: &egui::Context) { +pub(in crate::state) fn ctrl_z(state: &mut AppState, ctx: &egui::Context) { let z = Key::Character("z".into()); press( state, @@ -52,7 +52,7 @@ fn steps(state: &AppState, doc: DocumentId) -> usize { state.document(doc).expect("open").history.done().len() } -pub(super) fn name_of(state: &AppState, doc: DocumentId, row: RpfNodeId) -> String { +pub(in crate::state) fn name_of(state: &AppState, doc: DocumentId, row: RpfNodeId) -> String { match state.document(doc).map(|d| &d.payload) { Some(DocPayload::Rpf(rpf)) => rpf.session.node(row).map(|n| n.name.clone()), _ => None, @@ -109,14 +109,14 @@ fn type_name(ctx: &egui::Context, state: &mut AppState, name: &str) { frame(ctx, state, vec![enter]); } -pub(super) fn rename_with_f2(ctx: &egui::Context, state: &mut AppState, name: &str) { +pub(in crate::state) fn rename_with_f2(ctx: &egui::Context, state: &mut AppState, name: &str) { let f2 = Key::Named(NamedKey::F2); press(state, ctx, f2, KeyCode::F2, ModifiersState::empty()); type_name(ctx, state, name); } /// An archive holding `notes.txt`, none of it on disk. -pub(super) fn an_archive(state: &mut AppState) -> (DocumentId, RpfNodeId) { +pub(in crate::state) fn an_archive(state: &mut AppState) -> (DocumentId, RpfNodeId) { let archive = state.new_empty_document(DocumentKind::Rpf); let Some(DocPayload::Rpf(rpf)) = state.document_mut(archive).map(|d| &mut d.payload) else { panic!("an empty archive document holds an archive"); diff --git a/src/state/uses_and_used_by_in_the_app.rs b/src/state/tests/uses_and_used_by_in_the_app.rs similarity index 91% rename from src/state/uses_and_used_by_in_the_app.rs rename to src/state/tests/uses_and_used_by_in_the_app.rs index d822e29fb..377b753b8 100644 --- a/src/state/uses_and_used_by_in_the_app.rs +++ b/src/state/tests/uses_and_used_by_in_the_app.rs @@ -18,17 +18,17 @@ use or_io::meta::{ SchemaLibrary, StringKind, StructDef, Value, }; -use super::document::{DocumentId, RpfNodeId}; -use super::document_io::empty_file_bytes_for_kind; -use super::navigation::{resolve_path, Arrival, Resolved}; use super::nested_archives_survive_a_save::archive; use super::the_files_view_in_the_centre::leaf_of; -use super::{AppState, DocPayload, DocumentKind, Game, Prefs}; +use crate::state::document::{DocumentId, RpfNodeId}; +use crate::state::document_io::empty_file_bytes_for_kind; +use crate::state::navigation::{resolve_path, Arrival, Resolved}; use crate::state::panel_ids as ids; +use crate::state::{AppState, DocPayload, DocumentKind, Game, Prefs}; -pub(super) const PROPS: &str = "x64e.rpf/levels/gta5/props.rpf"; +pub(in crate::state) const PROPS: &str = "x64e.rpf/levels/gta5/props.rpf"; const MAP: &str = "x64e.rpf/levels/gta5/hw_props.ymap"; -pub(super) const DEADLINE: Duration = Duration::from_secs(120); +pub(in crate::state) const DEADLINE: Duration = Duration::from_secs(120); /// What the jobs list calls the install's read. const JOB: &str = "Uses and Placed by"; @@ -70,7 +70,7 @@ fn pointers(of: &str) -> FieldType { } /// `CMapTypes` and `CMapData` as far as a dependency index reads them. -pub(super) fn library() -> SchemaLibrary { +pub(in crate::state) fn library() -> SchemaLibrary { let hash = || FieldType::String(StringKind::AtHashString); let mut lib = SchemaLibrary::new(); lib.insert_struct(structure( @@ -108,7 +108,7 @@ pub(super) fn library() -> SchemaLibrary { } /// `root` as PSO, which carries its own layout, so it reads with no schema. -pub(super) fn pso(root: &MetaInstance) -> Vec { +pub(in crate::state) fn pso(root: &MetaInstance) -> Vec { let layout = MetaLayout { format: BinaryFormat::Pso, container: ContainerLayout::Pso( @@ -118,13 +118,13 @@ pub(super) fn pso(root: &MetaInstance) -> Vec { or_io::meta::write_meta_binary(BinaryFormat::Pso, Some(&layout), root).expect("PSO") } -pub(super) fn hashed(name: &str) -> Value { +pub(in crate::state) fn hashed(name: &str) -> Value { Value::Hash(HashedString::new(name)) } /// `v_props.ytyp`: `prop_bench`, textured by `props_txd`, which the install /// holds, and `prop_lamp`, by `lamp_txd`, which it does not. -pub(super) fn types() -> Vec { +pub(in crate::state) fn types() -> Vec { let archetype = |name: &str, txd: &str| { let mut archetype = MetaInstance::new("CBaseArchetypeDef"); archetype.set("name", hashed(name)); @@ -145,12 +145,12 @@ pub(super) fn types() -> Vec { } /// `hw_props.ymap`, placing `prop_bench` twice. -pub(super) fn map() -> Vec { +pub(in crate::state) fn map() -> Vec { placing("hw_props") } /// The map `name`, placing `prop_bench` twice: its stem and its `name` agree, as a placement is found by the one. -pub(super) fn placing(name: &str) -> Vec { +pub(in crate::state) fn placing(name: &str) -> Vec { let entity = |x: f32| { let mut entity = MetaInstance::new("CEntityDef"); entity.set("archetypeName", hashed("prop_bench")); @@ -168,7 +168,7 @@ pub(super) fn placing(name: &str) -> Vec { /// An install: `common.rpf`, which a mount needs, and `x64e.rpf`, holding the /// map and `props.rpf`, which holds the two drawables, a texture dictionary /// and the type file declaring them. -pub(super) fn install() -> tempfile::TempDir { +pub(in crate::state) fn install() -> tempfile::TempDir { let dir = tempfile::tempdir().expect("an install folder"); let ydr = empty_file_bytes_for_kind(DocumentKind::Ydr).expect("a blank drawable"); let ytd = empty_file_bytes_for_kind(DocumentKind::Ytd).expect("a blank texture dictionary"); @@ -189,7 +189,7 @@ pub(super) fn install() -> tempfile::TempDir { } /// `root` as the remembered install, opened as a launch opens it, and its tree. -pub(super) fn cold(root: &Path) -> (AppState, DocumentId) { +pub(in crate::state) fn cold(root: &Path) -> (AppState, DocumentId) { let mut prefs = Prefs::default(); (prefs.game_paths).set(Game::GtaVLegacy, Some(root.to_path_buf())); prefs.active_game = Some(Game::GtaVLegacy); @@ -202,7 +202,7 @@ pub(super) fn cold(root: &Path) -> (AppState, DocumentId) { } /// The leaves of the files `openrage-cli depends export` copies for `subject`. -pub(super) fn clis_set(root: &Path, subject: &str) -> Vec { +pub(in crate::state) fn clis_set(root: &Path, subject: &str) -> Vec { let scratch = tempfile::tempdir().expect("a scratch folder"); let out = scratch.path().join("set"); // ⚠ A key file that is not there, so the command reads no user's keys cache. @@ -233,11 +233,11 @@ pub(super) fn clis_set(root: &Path, subject: &str) -> Vec { /// A widget one frame drew. #[derive(Debug, Clone)] -pub(super) struct Drawn { - pub(super) role: Role, - pub(super) label: String, - pub(super) disabled: bool, - pub(super) at: egui::Pos2, +pub(in crate::state) struct Drawn { + pub(in crate::state) role: Role, + pub(in crate::state) label: String, + pub(in crate::state) disabled: bool, + pub(in crate::state) at: egui::Pos2, } /// Whether a widget's text is `label`, behind the glyphs a row's icon puts first. @@ -246,13 +246,13 @@ fn named(text: &str, label: &str) -> bool { } /// The dock drawn through real frames, ticking what the editor's redraw ticks. -pub(super) struct Screen { +pub(in crate::state) struct Screen { ctx: egui::Context, time: std::cell::Cell, } impl Screen { - pub(super) fn new() -> Self { + pub(in crate::state) fn new() -> Self { let ctx = egui::Context::default(); ctx.enable_accesskit(); Self { @@ -261,7 +261,11 @@ impl Screen { } } - pub(super) fn frame(&self, state: &mut AppState, events: Vec) -> Vec { + pub(in crate::state) fn frame( + &self, + state: &mut AppState, + events: Vec, + ) -> Vec { state.poll_load_result(); state.poll_expansions(); state.tick_navigation(); @@ -296,7 +300,7 @@ impl Screen { } /// What the frames of a click and the one after drew, each frame's widgets after the last's. - pub(super) fn click( + pub(in crate::state) fn click( &self, state: &mut AppState, at: egui::Pos2, @@ -315,7 +319,7 @@ impl Screen { } /// Draw until `done` holds of the state and of what a frame drew. - pub(super) fn until( + pub(in crate::state) fn until( &self, state: &mut AppState, what: &str, @@ -339,7 +343,7 @@ impl Screen { /// Reveal `path` of `doc` in Files, open its row's menu, then its submenu /// `submenu`, and return what the frames that opened it drew. - pub(super) fn submenu( + pub(in crate::state) fn submenu( &self, state: &mut AppState, doc: DocumentId, @@ -400,7 +404,7 @@ fn row_at(state: &AppState, doc: DocumentId, path: &str) -> Option { } /// The path inside `doc` of each archive entry open as a document of its own. -pub(super) fn opened_entries(state: &AppState, doc: DocumentId) -> Vec { +pub(in crate::state) fn opened_entries(state: &AppState, doc: DocumentId) -> Vec { let Some(DocPayload::Rpf(rpf)) = state.document(doc).map(|d| &d.payload) else { return Vec::new(); }; @@ -415,7 +419,7 @@ pub(super) fn opened_entries(state: &AppState, doc: DocumentId) -> Vec { /// /// ⚠ A submenu's rows line up with its menu's, so the menu's own items share /// their rows: only the nearest item to the left is beside the Reveal. -pub(super) fn listed(drawn: &[Drawn]) -> Vec<&Drawn> { +pub(in crate::state) fn listed(drawn: &[Drawn]) -> Vec<&Drawn> { (drawn.iter()) .filter(|reveal| reveal.label == "Reveal in tree") .filter_map(|reveal| { @@ -437,15 +441,15 @@ fn key(key: egui::Key) -> egui::Event { } } -pub(super) fn reading(state: &AppState) -> bool { +pub(in crate::state) fn reading(state: &AppState) -> bool { (state.running_jobs().iter()).any(|job| job.kind.label() == JOB) } -pub(super) fn read(state: &AppState) -> bool { +pub(in crate::state) fn read(state: &AppState) -> bool { (state.jobs.ended().iter()).any(|job| job.kind.label() == JOB) } -pub(super) const LOOKING: &str = "Looking for what it uses…"; +pub(in crate::state) const LOOKING: &str = "Looking for what it uses…"; #[test] fn a_drawables_uses_lists_its_texture_dictionary_and_opens_it() { diff --git a/src/state/uses_over_a_retail_install.rs b/src/state/tests/uses_over_a_retail_install.rs similarity index 100% rename from src/state/uses_over_a_retail_install.rs rename to src/state/tests/uses_over_a_retail_install.rs diff --git a/src/state/uses_reaches_every_pack.rs b/src/state/tests/uses_reaches_every_pack.rs similarity index 95% rename from src/state/uses_reaches_every_pack.rs rename to src/state/tests/uses_reaches_every_pack.rs index 5d5dd806f..bce92f1a8 100644 --- a/src/state/uses_reaches_every_pack.rs +++ b/src/state/tests/uses_reaches_every_pack.rs @@ -13,16 +13,16 @@ use or_io::gta5::{PhBoundAny, PhBoundSphere}; use or_io::meta::{MetaInstance, Value}; use or_title::{ContentXml, DlcList, SetupData}; -use super::document_io::empty_file_bytes_for_kind; use super::nested_archives_survive_a_save::archive; use super::uses_and_used_by_in_the_app::{ clis_set, cold, hashed, listed, opened_entries, placing, pso, types, Screen, PROPS, }; -use super::DocumentKind; +use crate::state::document_io::empty_file_bytes_for_kind; +use crate::state::DocumentKind; /// Where `testpack`'s `dlc1.rpf` sits in the install. const SUB_PACK: &str = "x64/dlcpacks/testpack/dlc1.rpf"; -pub(super) const MAPS: &str = "x64e.rpf/levels/gta5"; +pub(in crate::state) const MAPS: &str = "x64e.rpf/levels/gta5"; fn write(path: &Path, bytes: &[u8]) { std::fs::create_dir_all(path.parent().expect("a parent")).expect("a folder"); @@ -71,7 +71,7 @@ fn install_with_a_dlc() -> tempfile::TempDir { } /// `plain_map.ymap`, streaming from -100 to 100 on each axis. -pub(super) fn plain_map() -> Vec { +pub(in crate::state) fn plain_map() -> Vec { let mut root = MetaInstance::new("CMapData"); root.set("name", hashed("plain_map")); root.set("entities", Value::Array(Vec::new())); @@ -81,7 +81,7 @@ pub(super) fn plain_map() -> Vec { } /// A `.ybn` whose header box spans `min` to `max`. -pub(super) fn bound_spanning(min: [f32; 3], max: [f32; 3]) -> Vec { +pub(in crate::state) fn bound_spanning(min: [f32; 3], max: [f32; 3]) -> Vec { let mut sphere = PhBoundSphere::default(); sphere.base.bounding_box_max_xyz_margin_w = Vec4V { x: max[0], @@ -98,7 +98,7 @@ pub(super) fn bound_spanning(min: [f32; 3], max: [f32; 3]) -> Vec { /// An install holding `plain_map.ymap`, no imap group naming it, and the three /// `.ybn` its stem names: one inside its streaming box, one outside it, and /// one that is no bound at all. -pub(super) fn install_with_a_map() -> tempfile::TempDir { +pub(in crate::state) fn install_with_a_map() -> tempfile::TempDir { let dir = tempfile::tempdir().expect("an install folder"); let x64e = archive(&[ ("levels/gta5/plain_map.ymap", &plain_map()), diff --git a/src/state/viewing_never_edits.rs b/src/state/tests/viewing_never_edits.rs similarity index 96% rename from src/state/viewing_never_edits.rs rename to src/state/tests/viewing_never_edits.rs index b6ef07213..639ffa768 100644 --- a/src/state/viewing_never_edits.rs +++ b/src/state/tests/viewing_never_edits.rs @@ -7,9 +7,9 @@ use std::path::{Path, PathBuf}; use super::opening_a_ydd::finish_load; -use super::prefs::Game; -use super::{AppState, CloseAnswer, DocumentId}; +use crate::state::prefs::Game; use crate::state::Workspace; +use crate::state::{AppState, CloseAnswer, DocumentId}; use crate::ui::dock::Tab; const WHAT: &str = "opening a file of every kind and drawing every panel modifies no document"; @@ -18,7 +18,7 @@ const WHAT: &str = "opening a file of every kind and drawing every panel modifie const FRAMES: usize = 3; /// The smallest staged file of each extension the app opens, per target, from the shared and the metadata corpus. -pub(super) fn one_file_of_every_kind() -> Vec { +pub(in crate::state) fn one_file_of_every_kind() -> Vec { let meta = or_test_support::owned_corpus_origin( "or-meta", env!("CARGO_MANIFEST_DIR"), @@ -27,7 +27,7 @@ pub(super) fn one_file_of_every_kind() -> Vec { ); let size = |path: &PathBuf| std::fs::metadata(path).map_or(u64::MAX, |m| m.len()); let mut files = Vec::new(); - for ext in super::kinds::openable_extensions() { + for ext in crate::state::kinds::openable_extensions() { for corpus in [ or_test_support::Corpus::new(env!("CARGO_MANIFEST_DIR"), ext), or_test_support::Corpus::with_root(meta.path(), ext), diff --git a/src/state/viewport_basics_for_inspecting_assets.rs b/src/state/tests/viewport_basics_for_inspecting_assets.rs similarity index 95% rename from src/state/viewport_basics_for_inspecting_assets.rs rename to src/state/tests/viewport_basics_for_inspecting_assets.rs index c105d1513..5df81f0bd 100644 --- a/src/state/viewport_basics_for_inspecting_assets.rs +++ b/src/state/tests/viewport_basics_for_inspecting_assets.rs @@ -8,11 +8,11 @@ use glam::Vec3; use or_renderer::{OrbitCamera, ShadingMode}; use or_test_support::{skip_corpus, Corpus, TARGET_GEN8, TARGET_GEN9}; -use super::prefs::{load_prefs_from, save_prefs_to, Prefs}; -use super::{AppState, DocPayload, DocumentId, SelectionKey}; use crate::render::meshes::{drawable_parts, Material, MeshUpload}; use crate::render::viewport::pick::{select_under, Ray}; use crate::render::viewport::CameraInputs; +use crate::state::prefs::{load_prefs_from, save_prefs_to, Prefs}; +use crate::state::{AppState, DocPayload, DocumentId, SelectionKey}; use crate::ui::commands::Action; use crate::ui::shortcuts::{action_for, ShortcutMods}; use crate::ui::theme; @@ -24,7 +24,7 @@ const AWAY: f32 = 0.1; type Part = ((usize, usize), MeshUpload); /// The first staged file of `extension` and `target` that `drawn` finds something in. -pub(super) fn staged( +pub(in crate::state) fn staged( extension: &str, target: &str, drawn: impl Fn(&or_io::Asset) -> Option, @@ -40,7 +40,7 @@ pub(super) fn staged( } /// What a drawable's first level of detail draws, where that is two geometries or more. -pub(super) fn two_or_more(asset: &or_io::Asset) -> Option> { +pub(in crate::state) fn two_or_more(asset: &or_io::Asset) -> Option> { let parts = match asset { or_io::Asset::Drawable(d) => drawable_parts(&d.base, 0, None), or_io::Asset::DrawableGen9(d) => drawable_parts(&d.base, 0, None), @@ -98,7 +98,7 @@ fn a_face_in_sight(parts: &[Part], target: (usize, usize)) -> Option<(Vec3, Vec3 } /// The last geometry drawn, and one of its faces in sight. -pub(super) fn the_last_in_sight(parts: &[Part]) -> Option<((usize, usize), Vec3, Vec3)> { +pub(in crate::state) fn the_last_in_sight(parts: &[Part]) -> Option<((usize, usize), Vec3, Vec3)> { let target = parts.last()?.0; let (centre, normal) = a_face_in_sight(parts, target)?; Some((target, centre, normal)) @@ -131,7 +131,7 @@ fn box_centre( /// Whether the Outline, drawn too short to show every row unscrolled, shows a row labelled `label` /// once it has settled. -pub(super) fn the_outline_shows(state: &mut AppState, label: &str) -> bool { +pub(in crate::state) fn the_outline_shows(state: &mut AppState, label: &str) -> bool { the_outline_settles_with(state, |screen, output| { let update = output.platform_output.accesskit_update?; Some(update.nodes.iter().any(|(_, node)| { @@ -146,7 +146,7 @@ pub(super) fn the_outline_shows(state: &mut AppState, label: &str) -> bool { /// Whether the Outline, settled as above, shows a row labelled `label` in the colour of a selected /// row; egui does not tell a screen reader which row of a list is selected. -pub(super) fn the_outline_selects(state: &mut AppState, label: &str) -> bool { +pub(in crate::state) fn the_outline_selects(state: &mut AppState, label: &str) -> bool { // The palette it compares with is the process's: a theme test must not flip it between the draw and the read let _serial = crate::ui::theme::serial(); /// The colour of the last section of the text `shape` paints that holds `label`, which is the @@ -196,7 +196,10 @@ fn the_outline_settles_with( shown } -pub(super) fn opened(path: &std::path::Path, asset: or_io::Asset) -> (AppState, DocumentId) { +pub(in crate::state) fn opened( + path: &std::path::Path, + asset: or_io::Asset, +) -> (AppState, DocumentId) { let mut state = AppState::from_prefs(Prefs::default()); let doc = state.insert_document(path.to_path_buf(), DocPayload::Resource(asset), None, None); (state, doc) @@ -267,7 +270,7 @@ fn a_click_selects_the_geometry_under_the_cursor_in_the_outline_f_frames_it_and_ } /// Whether the viewport's row of controls, drawn at the default window size, shows `text`. -pub(super) fn the_row_shows(state: &mut AppState, text: &str) -> bool { +pub(in crate::state) fn the_row_shows(state: &mut AppState, text: &str) -> bool { let ctx = egui::Context::default(); ctx.enable_accesskit(); (the_row(&ctx, state, Vec::new()).iter()).any(|(shown, _)| shown.contains(text)) @@ -300,7 +303,7 @@ fn the_row( } /// Click the control the viewport's row labels `label`, as a pointer does; whether there is one. -pub(super) fn click_in_the_row(state: &mut AppState, label: &str) -> bool { +pub(in crate::state) fn click_in_the_row(state: &mut AppState, label: &str) -> bool { let ctx = egui::Context::default(); ctx.enable_accesskit(); let shown = the_row(&ctx, state, Vec::new()); @@ -400,7 +403,7 @@ fn the_overlays_leave_the_axis_gizmo_clear_and_fit_a_narrow_viewport() { } /// How many rows of the Outline, drawn on a screen tall enough to show every one, are labelled `label`. -pub(super) fn the_outline_rows_labelled(state: &mut AppState, label: &str) -> usize { +pub(in crate::state) fn the_outline_rows_labelled(state: &mut AppState, label: &str) -> usize { let ctx = egui::Context::default(); ctx.enable_accesskit(); let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(420.0, 4000.0)); diff --git a/src/state/what_a_comparison_still_missed.rs b/src/state/tests/what_a_comparison_still_missed.rs similarity index 95% rename from src/state/what_a_comparison_still_missed.rs rename to src/state/tests/what_a_comparison_still_missed.rs index 2dd771e43..e4465f8fe 100644 --- a/src/state/what_a_comparison_still_missed.rs +++ b/src/state/tests/what_a_comparison_still_missed.rs @@ -15,16 +15,16 @@ use or_test_support::{game_roots, skip_corpus, Corpus}; use or_title::game::Game; use or_title::install::discovery::{discover_installs, DiscoveredInstall, DiscoverySource}; -use super::compare::Change; use super::comparing_every_resource_and_archive::{compare_files, quad_mesh, row, rows, saved}; use super::comparing_two_files::{command, run, shown, state}; use super::defragmenting_an_archive::{fragmented, settle}; -use super::jobs::JobKind; use super::nested_archives_survive_a_save::archive as archive_bytes; use super::opening_a_ydd::node_at; -use super::prefs::EditMode; -use super::{document_io, DocumentKind, RetailEditDecision}; use crate::render::bound_meshes::shapes::composite; +use crate::state::compare::Change; +use crate::state::jobs::JobKind; +use crate::state::prefs::EditMode; +use crate::state::{document_io, DocumentKind, RetailEditDecision}; use crate::ui::commands::Action; /// A drawable called `name` whose bound is a quad of the materials `surface` names. @@ -257,7 +257,7 @@ fn compare_with_selected_is_disabled_with_its_reason_on_an_archive_being_defragm node_at(&mut state, folder, "b.rpf"), ); run(&mut state, Action::SelectForCompare, folder, b); - let with_selected = |state: &super::AppState, row| { + let with_selected = |state: &crate::state::AppState, row| { command(state, Action::CompareWithSelected, folder, row).enabled }; assert_eq!(with_selected(&state, a), Ok(()), "nothing holds it yet"); @@ -285,7 +285,7 @@ fn compare_with_selected_is_disabled_with_its_reason_on_an_archive_being_defragm } /// How many comparisons are running, and how many tabs show one. -fn comparisons(state: &super::AppState) -> (usize, usize) { +fn comparisons(state: &crate::state::AppState) -> (usize, usize) { let running = (state.running_jobs().iter()) .filter(|job| job.kind == JobKind::Compare) .count(); @@ -311,8 +311,9 @@ fn compare_with_original_is_disabled_and_refused_while_a_defragment_holds_either let game = state.open_game_root(root.path().to_path_buf()); let shipped = node_at(&mut state, game, "update/update.rpf"); let modded = node_at(&mut state, game, "mods/update/update.rpf"); - let with_original = - |state: &super::AppState| command(state, Action::CompareWithOriginal, game, modded).enabled; + let with_original = |state: &crate::state::AppState| { + command(state, Action::CompareWithOriginal, game, modded).enabled + }; assert_eq!(with_original(&state), Ok(()), "nothing holds either yet"); // The game's own copy, which a defragment asks about first, then the overlay's. @@ -352,7 +353,11 @@ fn compare_with_original_is_disabled_and_refused_while_a_defragment_holds_either } /// Select for compare on `row`, which a defragment may hold. -fn run_select(state: &mut super::AppState, doc: super::DocumentId, row: super::RpfNodeId) { +fn run_select( + state: &mut crate::state::AppState, + doc: crate::state::DocumentId, + row: crate::state::RpfNodeId, +) { run(state, Action::SelectForCompare, doc, row); } @@ -383,7 +388,7 @@ fn staged_outline( depth: usize, ) -> Option<( std::sync::Arc, - std::sync::Arc, + std::sync::Arc, Outline, )> { let kind = DocumentKind::from_path(Path::new(name))?; @@ -407,7 +412,7 @@ fn a_comparison_reads_every_staged_file_to_its_last_part() { for (name, bytes) in sampled(format) { let outline = |depth| staged_outline(format, &name, &bytes, depth); let (Some((.., inspectors)), Some((.., here))) = - (outline(MAX_DEPTH), outline(super::compare::DEPTH)) + (outline(MAX_DEPTH), outline(crate::state::compare::DEPTH)) else { continue; }; @@ -429,7 +434,7 @@ fn a_comparison_reads_every_staged_file_to_its_last_part() { assert!( cut_here.is_empty(), "parts past a comparison's depth of {}: {cut_here:?}", - super::compare::DEPTH + crate::state::compare::DEPTH ); } @@ -471,7 +476,7 @@ fn no_staged_file_holds_an_untyped_trailing_run_in_the_physical_segment() { for format in or_io::gta5::formats::FORMATS { for (name, bytes) in sampled(format) { let Some((pack, image, outline)) = - staged_outline(format, &name, &bytes, super::compare::DEPTH) + staged_outline(format, &name, &bytes, crate::state::compare::DEPTH) else { continue; }; @@ -497,7 +502,7 @@ fn no_staged_file_holds_an_untyped_trailing_run_in_the_physical_segment() { } /// The install roots a test reads: those `told` names, else those `found` says the app finds. -pub(super) fn install_roots_told_else_found( +pub(in crate::state) fn install_roots_told_else_found( told: Vec, found: impl FnOnce() -> Vec, ) -> Vec { @@ -513,7 +518,7 @@ pub(super) fn install_roots_told_else_found( } /// The installs an install-gated test reads, `OPENRAGE_GAME_ROOT` or none named and then the app's own discovery. -pub(super) fn install_roots() -> Vec { +pub(in crate::state) fn install_roots() -> Vec { install_roots_told_else_found(game_roots(), discover_installs) } diff --git a/src/state/what_archive_rows_still_get_wrong.rs b/src/state/tests/what_archive_rows_still_get_wrong.rs similarity index 96% rename from src/state/what_archive_rows_still_get_wrong.rs rename to src/state/tests/what_archive_rows_still_get_wrong.rs index 84f1bb3dd..833cce879 100644 --- a/src/state/what_archive_rows_still_get_wrong.rs +++ b/src/state/tests/what_archive_rows_still_get_wrong.rs @@ -7,15 +7,15 @@ use std::path::Path; use or_io::container::rpf::BodyForm; use super::every_add_lands_where_the_tree_shows_it::opened; -use super::extract_job::{ExtractStart, TypeFilter}; use super::nested_archives_survive_a_save::{archive, errors}; use super::nothing_extracts_into_an_install::{files_under, run_to_completion}; use super::opening_a_ydd::node_at; -use super::os_drop::DropTarget; -use super::prefs::EditMode; use super::two_readers_of_one_archive_across_a_save::install; -use super::AppState; use crate::platform::recycle_bin; +use crate::state::extract_job::{ExtractStart, TypeFilter}; +use crate::state::os_drop::DropTarget; +use crate::state::prefs::EditMode; +use crate::state::AppState; /// Every folder under `dir`, ending in `/`, and every file. fn everything_under(dir: &Path) -> Vec { diff --git a/src/state/what_the_create_menu_offers.rs b/src/state/tests/what_the_create_menu_offers.rs similarity index 96% rename from src/state/what_the_create_menu_offers.rs rename to src/state/tests/what_the_create_menu_offers.rs index 8633bbb1d..a1d7bdca4 100644 --- a/src/state/what_the_create_menu_offers.rs +++ b/src/state/tests/what_the_create_menu_offers.rs @@ -7,9 +7,9 @@ //! `handler_for(resource, Gen8).is_some()` — says nothing of whether the click //! succeeds. -use super::document_io::empty_file_bytes_for_kind; -use super::kinds; -use super::DocumentKind; +use crate::state::document_io::empty_file_bytes_for_kind; +use crate::state::kinds; +use crate::state::DocumentKind; /// Every enabled row is attempted for real. #[test] diff --git a/src/state/gta6_bcpack_calibration.rs b/src/state/ttpf_document/calibration.rs similarity index 100% rename from src/state/gta6_bcpack_calibration.rs rename to src/state/ttpf_document/calibration.rs diff --git a/src/state/ttpf_document.rs b/src/state/ttpf_document/mod.rs similarity index 99% rename from src/state/ttpf_document.rs rename to src/state/ttpf_document/mod.rs index 286f1b5b1..cb1d9660d 100644 --- a/src/state/ttpf_document.rs +++ b/src/state/ttpf_document/mod.rs @@ -889,9 +889,7 @@ pub(super) fn grc(name: String, texture: or_io::gta6::Texture) -> Result