Commit dbaf636
committed
Squashed version of inf-records-refactoring
commit c19ad63
Author: Infernio <infernio@icloud.com>
Date: Mon Dec 30 17:22:10 2019 +0100
Refactor records that changed between SSE and SLE
Instead of having two slightly different record definitions, have one
definition in the skyrim file and define the different subrecords via
unions with a 'GameDecider'. Gets rid of a lot of duplicate code that's
been irking me.
commit eb56b1b
Author: Infernio <infernio@icloud.com>
Date: Mon Dec 16 01:44:17 2019 +0100
FO3/FNV: Merge LVL* implementation back into brec
Had to add a new class variable to accomplish this, which should
probably be updated for Skyrim/FO4 as well. This also brings all fixes
and improvements (e.g. the 255+ items fix) that have landed in brec's
implementation to FO3 and FNV. Needed for the patchers refactoring, in
which we unify the ListsMerger and FidListsMerger classes.
commit 02a1144
Author: Infernio <infernio@icloud.com>
Date: Sat Nov 30 19:20:11 2019 +0100
Drop some pointless cruft
Drop MelBase.debug
Bad name, very pointless (since it dumps out so much output that the log
becomes useless), and worst of all, it slows down loading of everything,
even in release builds (since the if check and subsequent branch won't
be optimized out - this is CPython).
Drop MelRefrXmrk
REFR is in no shape to be loaded, and this isn't the way to handle that
anyways - a distributor is. Drops a few more print calls, which is nice.
Drop all prints in brec
Use deprints instead, should improve load/dump errors a bit.
commit 44b62dc
Author: Infernio <infernio@icloud.com>
Date: Thu Nov 28 00:44:27 2019 +0100
brec.MelArray
Drops brec.MelStructs and brec.MelStructA by replacing all usages with
MelGroups(MelStruct) and MelArray(MelStruct), respectively. Actually an
increase in line count. It does have other advantages, however:
- It is now possible to use other classes besides the plain MelStruct
with MelArray. For example, MelOptStruct, or any of the primitive
wrappers.
- Making MelArray usages explicit and forcing an indent via code style
guidelines makes it really easy to see which subrecords are
lists/arrays.
- You no longer have to learn a 'completely new class', MelStructA,
just a different way of loading a class you already know, MelStruct.
commit d03e524
Author: Infernio <infernio@icloud.com>
Date: Wed Nov 27 17:31:21 2019 +0100
brec.MelFull
Same idea as with brec.MelEdid. Note that this will make PBash slightly
slower for Oblivion, FO3 and FNV, since those will now use MelLString,
which will have to check self.hasStrings to determine that it doesn't
have to worry about strings. Probably not worth worrying about, but feel
free to benchmark.
commit 277d7b7
Author: Infernio <infernio@icloud.com>
Date: Wed Nov 27 17:18:59 2019 +0100
brec.MelEdid
Slightly increases line count, but the benefit here is that we move the
definition of editor IDs into a single place - so all the usual benefits
of using a constant instead of repeating its value everywhere.
commit 34cb87e
Author: Infernio <infernio@icloud.com>
Date: Wed Nov 27 16:51:14 2019 +0100
brec.MelIcons and related classes
Were sitting unused in Skyrim's record definitions. Less about the code
reduction, more about all the other benefits (e.g. typo protection, IDE
suggestions, etc.).
commit 6b146ab
Author: Infernio <infernio@icloud.com>
Date: Wed Nov 27 01:23:12 2019 +0100
FO3, FNV: Finish some struct definitions
Were marked as '#--Should be a struct. Maybe later.', so I finished
them. Note that one of them *shouldn't* be a struct, it's 304 bytes of
unused junk.
FO3: Drop unused MelPnamNam0Handler
Was duplicating MelStructA unnecessarily. Copy-pasted from FNV, but FNV
only needs it to handle records that use FO3's older format, so it's
obviously pointless in FO3.
brec.MelReadOnly
Puts to rest the MelSounSndx nonsense by standardizing it. Also
expands SNDD/SNDX handling to incorporate ANAM/GNAM/HNAM, mirroring what
xEdit does.
commit 7b5b54d
Author: Infernio <infernio@icloud.com>
Date: Fri Nov 22 01:58:31 2019 +0100
brec.MelTruncatedStruct
The big one. Tons of duplicate classes have died sudden, brutish deaths.
Replace MelPackLT with MelUnion
Also allows MelTruncatedStruct to handle the upgrading part of this
monstrosity.
Move MelCoordinates to brec
Deduplicates the CELL definitions a bit - unnecessarily complex for
Oblivion, but saves 3 lines, so...
Minor SSE MATO/STAT updates
Added proper defaults and changed names to sync with xEdit.
Drop unknownX from SCRL/SPEL flags
Too lazy to make a new commit for this :P
commit 2a38aee
Author: Infernio <infernio@icloud.com>
Date: Sat Nov 9 00:31:58 2019 +0100
More random record fixes
FO3, FNV: Fix MelModel dumping invalid flags
MOD2 and MOD4 subrecords have no MODD/MOSD equivalent. Additionally,
'WEAP/Scope Model' does not have a MOSD subrecord either. This was
causing xEdit to spit out errors when loading the BP:
[00:04] Background Loader: Error: record ARMO contains unexpected (or out of order) subrecord MO2D 44324F4D
[00:04] Background Loader: Error: record ARMO contains unexpected (or out of order) subrecord MO4D 44344F4D
[00:04] Background Loader: Errors were found in: HelmetNVNCRTrooperMP "MP Trooper Helmet" [ARMO:0010BEE9]
[00:02] Background Loader: Error: record WEAP contains unexpected (or out of order) subrecord MOSD 44534F4D
[00:02] Background Loader: Errors were found in: WeapLaserRifle "Laser Rifle" [WEAP:00004336]
FO3, FNV: Make model facegen flags optional
Were previously MelBase, but should clearly be optional, otherwise we
make a ton of unneeded record edits.
FO3: Fix CLAS/ATTR definition
MelStructA makes no sense here, this is just a fixed-length subrecord,
MelStruct is perfectly acceptable.
Drop MelTuple
Only four usages, and not one of them needed it. Also updated those
unkowns to be in line with xEdit, since they're actually decoded there.
TES4: Support fids in MISC
We were merging this already :/ Thankfully, these seem to be rare to
non-existent, so probably wasn't a huge problem.
commit 30a2ab7
Author: Infernio <infernio@icloud.com>
Date: Fri Nov 8 05:23:39 2019 +0100
Refactor embedded scripts
Moved some common code to brec (MelScriptVars), but most of the savings
are possible due to the new brec.MelSequential.
Use MelSequential for MelKeywords
Allows us to expose the keywords list directly at the top level - a bit
more intuitive to use than when it's hiding behind a MelObject.
commit 3b9fcec
Author: Infernio <infernio@icloud.com>
Date: Fri Nov 8 04:02:27 2019 +0100
Move bass.null{1,2,3,4} to brec
Only used in records code, so makes much more sense there. Also allows
some bass imports to be dropped.
commit d605647
Author: Infernio <infernio@icloud.com>
Date: Sun Oct 20 14:45:35 2019 +0200
Move MelBounds to brec
Applies it to FO3 and FNV as well for a significant reduction in code
duplication. Also wraps the struct inside a group, which is a
prerequisite for inf-461-patchers, in which we devise a new patcher to
handle object bounds.
commit c626e1c
Author: Infernio <infernio@icloud.com>
Date: Sat Nov 2 17:34:29 2019 +0100
Improve ModSizeError usage
Now shows all sizes that the load method could possibly accept. Was also
able to drop the exact_size parameter as a result.
Also eliminates all 'raise "Some string here"' usages by standardizing
them to use ModSizeError/ModError instead.
commit 907e078
Author: Infernio <infernio@icloud.com>
Date: Thu Oct 24 00:18:08 2019 +0200
Drop MelFull0
One of the reasons for starting this branch was to exterminate this ugly
hack with extreme prejudice. It's only needed for 5 types in Oblivion,
but has to be checked for *every* subrecord for every record type in all
games. Yuck. _MelDistributor was the final nail in the coffin that
allowed this to be dropped.
commit 685229e
Author: Infernio <infernio@icloud.com>
Date: Thu Oct 10 19:13:00 2019 +0200
brec._MelDistributor
Our solution to duplicate subrecord signatures. *Very* powerful, was
built with Skyrim's RACE record type in mind. Will write a wiki page
shortly (for this and all the other tools I built on this branch).
Refactor with _MelDistributor
Pleasant side effect is that we drop the DataDict imports in each of the
records files.
TES4: Semi-rewrite MreRace implementation
Would have been painful to make this work with MelDistributor otherwise.
FO3, FNV: Semi-rewrite MreRace implementation
Also dropped the FNV override, since it's actually identical - both our
definitions, as well as the xEdit ones.
commit 1c8c5f6
Author: lojack5 <lojo.jacob@gmail.com>
Date: Sat Oct 26 20:23:52 2019 +0200
TES5: Rewrite VMAD
This is a revived and finished version of the (very) old lojack-vmad
branch. Revived this because our PERK implementation is broken without
it (whoops). It's also another significant leap towards
patching/merging/ESL-checking every record type.
Almost completely rewritten to update it for changes, PEP8 it, heavily
reduce code duplication, (hopefully) make refactoring and moving it to
brec eventually possible (for FO4 and future games), etc.
Co-authored-by: Infernio <infernio@icloud.com>
commit 5c683ee
Author: Infernio <infernio@icloud.com>
Date: Thu Oct 24 05:22:18 2019 +0200
brec.MelCounter, brec.MelPartialCounter
Attacking the problem of updating a counter element from the other
direction! Instead of creating more and more MelCounted* classes, why
not make some classes that update the counter instead?
MelCounter is straight-forward, just updates a single-value struct.
MelPartialCounter targets structs that contain more than just a counter.
Threw in some docstring noops.
Refactor with MelCounter and MelPartialCounter
Have I mentioned how fun deleting giant ugly piles of duplicate code is?
brec didn't even increase in size much, since I was able to drop both
MelCounted* classes. Also implemented counting for all counters that
xEdit supports that we didn't update yet.
Refactor MelItems and MelItemsCounter
Was used in only one place, let's use it to replace some more duplicate
code.
commit 214ee60
Author: Infernio <infernio@icloud.com>
Date: Thu Oct 24 00:28:32 2019 +0200
Primitive type wrappers in brec
This is more about limiting the use of MelStruct in favor of more
specialized and therefore less error-prone (e.g. due to a much more
contrained __init__ method) classes.
Refactor with the new primitives
Since this commit is completely boring and no one will slog through it,
I threw in some formatting changes (newlines, docstrings, etc.) and some
MelModel improvements.
commit 8074fc2
Author: Infernio <infernio@icloud.com>
Date: Wed Oct 23 07:10:03 2019 +0200
Random record fixes
Just random ones I stumbled across while looking through.
TES5: Drop unused classes, drop MelDecalData argument
FO3: PERK fixup
FO3: Some minor records fixes
FNV: Fix MreDial import
Fixup for ed3e24b, pycharm did not like
that class inheritance (might not have worked either? not sure).
MelStructA: Don't dump empty arrays
Uncomment SNDD - unused, but may be present.
0xcd -> \xcd
commit 70bf97e
Author: Infernio <infernio@icloud.com>
Date: Wed Oct 23 19:01:09 2019 +0200
Drop special group handling for REGN and BPDT
xEdit doesn't do this, so let's stop doing it too - might very well
break everything, so needs testing.
Edited to restore the behavior for FO3/FNV, testing shows it's needed
there.
commit 3f55c26
Author: Infernio <infernio@icloud.com>
Date: Thu Oct 24 02:48:37 2019 +0200
Drop brec.MelXpci
Was unused in anything but Oblivion and can be replaced by two MelNulls
in Oblivion (technically, MreRefr will now need a distributor, but we
obviously can't merge it yet, so that's not a problem).
commit 1395f0f
Author: Infernio <infernio@icloud.com>
Date: Wed Oct 23 19:35:40 2019 +0200
Drop unneeded comments in game/*/records.py
Many are redundant (e.g. the flags ones, we have the names right below
them) or unneeded (e.g. the 'Verified for 305' ones). Also dropped the
wbEnum ones, since we don't really care and if you really want to know,
you can always look at the xEdit definitions.
There were also a bunch of terrible docstrings in there:
def __init__(self, *whatever):
"""Initialize"""
I'd rather have no docstring than that - linters would complain about a
missing one, but not about this one, even though it contains absolutely
no useful information.
Makes scrolling through and editing these files much less painful,
especially on my laptop where pycharm no longer chokes quite as hard.
commit b51e8d2
Author: Infernio <infernio@icloud.com>
Date: Tue Oct 22 18:22:50 2019 +0200
brec.MelUnion
A union resolves to one of several possible elements, based on a
decider. Heavily inspired by xEdit's definitions, I completed this now
because it will be very useful for Morrowind (and also put to rest tons
of copy-pasted Mel* classes in the game-specific record definitions).
Refactor with MelUnion
Applying it everywhere - also includes a refactoring to allow MelGroups
to contain pretty much everything under the sun, which allowed a few
more custom classes to be absorbed here and will *really* come in handy
for Skyrim's RACE definition. Furthermore, I also moved the refactored
MelRegnEntrySubrecord to brec, since FO3, FNV and Skyrim all use it.
Note: None of these should change behavior. However, I am *not* certain
that the BPTD stuff was correct before. xEdit seems to have no special
treatment of BPTN/BPNN, whereas it does have have special treatment for
SCRO/SCRV and ALST/ALLS.1 parent ea131b3 commit dbaf636
42 files changed
Lines changed: 11360 additions & 10794 deletions
File tree
- Mopy
- Docs
- bash
- basher
- bosh
- game
- enderal/patcher
- fallout3
- patcher
- fallout4
- patcher
- falloutnv
- patcher
- oblivion
- patcher
- skyrimse
- patcher
- skyrim
- patcher
- patcher
- patchers
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
702 | 702 | | |
| 703 | + | |
703 | 704 | | |
704 | 705 | | |
705 | 706 | | |
706 | | - | |
| 707 | + | |
| 708 | + | |
707 | 709 | | |
| 710 | + | |
708 | 711 | | |
709 | 712 | | |
710 | | - | |
| 713 | + | |
711 | 714 | | |
712 | | - | |
713 | | - | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
714 | 719 | | |
715 | 720 | | |
716 | 721 | | |
717 | 722 | | |
718 | 723 | | |
719 | 724 | | |
720 | 725 | | |
721 | | - | |
| 726 | + | |
722 | 727 | | |
723 | 728 | | |
724 | 729 | | |
| |||
734 | 739 | | |
735 | 740 | | |
736 | 741 | | |
737 | | - | |
| 742 | + | |
738 | 743 | | |
739 | 744 | | |
740 | 745 | | |
| |||
1366 | 1371 | | |
1367 | 1372 | | |
1368 | 1373 | | |
1369 | | - | |
| 1374 | + | |
1370 | 1375 | | |
1371 | 1376 | | |
1372 | 1377 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2472 | 2472 | | |
2473 | 2473 | | |
2474 | 2474 | | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
2475 | 2479 | | |
| 2480 | + | |
| 2481 | + | |
2476 | 2482 | | |
| 2483 | + | |
2477 | 2484 | | |
2478 | 2485 | | |
2479 | 2486 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
993 | 993 | | |
994 | 994 | | |
995 | 995 | | |
996 | | - | |
997 | | - | |
998 | | - | |
999 | 996 | | |
1000 | 997 | | |
1001 | 998 | | |
| |||
1014 | 1011 | | |
1015 | 1012 | | |
1016 | 1013 | | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
1017 | 1020 | | |
1018 | 1021 | | |
1019 | 1022 | | |
| |||
1074 | 1077 | | |
1075 | 1078 | | |
1076 | 1079 | | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
1086 | 1100 | | |
1087 | 1101 | | |
1088 | 1102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1563 | 1563 | | |
1564 | 1564 | | |
1565 | 1565 | | |
1566 | | - | |
| 1566 | + | |
1567 | 1567 | | |
1568 | 1568 | | |
1569 | 1569 | | |
1570 | 1570 | | |
1571 | 1571 | | |
1572 | 1572 | | |
1573 | | - | |
| 1573 | + | |
1574 | 1574 | | |
1575 | 1575 | | |
1576 | | - | |
| 1576 | + | |
| 1577 | + | |
1577 | 1578 | | |
1578 | 1579 | | |
1579 | 1580 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | 35 | | |
42 | 36 | | |
43 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
0 commit comments