Advertisement
th3w1zard1

tslpatcher priority order for where to find the resource to be patched

Oct 5th, 2023 (edited)
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.11 KB | None | 0 0
  1. Wizard — Yesterday at 11:22 PM
  2. Could you confirm this is correct behavior when you get a chance?
  3. I could ask around if you aren’t sure
  4. ```
  5. search_order = [
  6. SearchLocation.OVERRIDE,
  7. SearchLocation.CUSTOM_MODULES,
  8. SearchLocation.CUSTOM_FOLDERS,
  9. ]
  10. if gff_patch.replace_file:
  11. search_order = [
  12. SearchLocation.CUSTOM_FOLDERS,
  13. SearchLocation.OVERRIDE,
  14. SearchLocation.CUSTOM_MODULES,
  15. ]
  16. search = installation.resource(
  17. resname,
  18. restype,
  19. search_order,
  20. folders=[self.mod_path],
  21. capsules=[] if capsule is None else [capsule],
  22. )
  23. ```
  24. Cortisol — Today at 12:03 AM
  25. Looks about right
  26. Wizard — Today at 12:04 AM
  27. if gff_patch.replace_file:
  28. search_order = [
  29. SearchLocation.CUSTOM_FOLDERS,
  30. SearchLocation.OVERRIDE,
  31. SearchLocation.CUSTOM_MODULES,
  32. ]
  33.  
  34. I wasn't sure if this should be Modules first then override
  35. Cortisol — Today at 12:05 AM
  36. Custom folder = tslpatchdata
  37. Wizard — Today at 12:05 AM
  38. right
  39. Cortisol — Today at 12:05 AM
  40. Custom module = the .mod in kotor/modules
  41. Override=self explanatory
  42. Wizard — Today at 12:05 AM
  43. if replace file, tslpatchdata first, then override, then modules. But wasn't sure if modules should be before override or not
  44. that's what i was asking my mistake
  45. Cortisol — Today at 12:06 AM
  46. Ah I see
  47. Do modules then override
  48. Wizard — Today at 12:06 AM
  49. what's your reasoning there?
  50. if replace_file == False, the order you established was Override --> Modules --> Custom folder
  51. (that was your fix on saturday)
  52. Cortisol — Today at 12:08 AM
  53. Yeah change it to modules override folder
  54. Wizard — Today at 12:08 AM
  55. Alright. Why though?
  56. Cortisol — Today at 12:08 AM
  57. Hmm hard to explain
  58. But if it's targeting a module
  59. [Some.utc]
  60. Target=modules/abc.mod
  61. And some.utc is in the override
  62. Wizard — Today at 12:09 AM
  63. So you think if !ReplaceFile is used, the order should essentially be reversed lol?
  64. Cortisol — Today at 12:09 AM
  65. It's going to take the wrong file
  66. Where as
  67. Wizard — Today at 12:09 AM
  68. search_order = [
  69. SearchLocation.CUSTOM_MODULES,
  70. SearchLocation.OVERRIDE,
  71. SearchLocation.CUSTOM_FOLDERS,
  72. ]
  73. if gff_patch.replace_file:
  74. search_order = [
  75. SearchLocation.CUSTOM_FOLDERS,
  76. SearchLocation.OVERRIDE,
  77. SearchLocation.CUSTOM_MODULES,
  78. ]
  79. search = installation.resource(
  80. resname,
  81. restype,
  82. search_order,
  83. folders=[self.mod_path],
  84. capsules=[] if capsule is None else [capsule],
  85. )
  86. Cortisol — Today at 12:10 AM
  87. [Some.utc]
  88. Target=override
  89. If Custom modules is first
  90. There is no Custom module
  91. And it skips to override
  92. Wizard — Today at 12:11 AM
  93. In that block I just posted, instead of hardcoding the priority order for override and modules, should we instead just parse the !Destination key-value pair to determine where to load the resource from first?
  94. Because it seems that it's dependent on the !Destination key
  95. From your explanation
  96. Wizard — Today at 12:12 AM
  97. I need to reread this a few times to make sure i understand
  98. Nah I'm still pretty confused
  99. Cortisol — Today at 12:16 AM
  100. If replace: folder, modules, override
  101. Else: modules, override, folder
  102. Wizard — Today at 12:16 AM
  103. Alright so breaking it down:
  104. !Destination=modules/somemodule.mod
  105. !ReplaceFile=0
  106.  
  107. Priority should be modules --> override --> tslpatchdata
  108. In your solution, it would be [modules, override, tslpatchdata]
  109. !Destination=override
  110. !ReplaceFile=0
  111.  
  112. Priority should be override --> modules --> tslpatchdata
  113. In your solution, it would be [modules, override, tslpatchdata]
  114. I'm beyond confused
  115. Cortisol — Today at 12:18 AM
  116. If !Destination is override it doesn't matter if custom modules precedes custom folders
  117. Because the custom modules array you pass through is empty
  118. Wizard — Today at 12:18 AM
  119. How do you know the modules is empty though?
  120. It could very well have a resource in there
  121. Cortisol — Today at 12:18 AM
  122. No
  123. Look at the code. I think the list is named capsules
  124. That list is what CUSTOM_MODULES searches through
  125. If gff.destination does not end with mod that list is empty
  126. Or something along those lines. Don't have the code in front of me
  127. Wizard — Today at 12:20 AM
  128. search = installation.resource(
  129. resname,
  130. restype,
  131. search_order,
  132. folders=[self.mod_path],
  133. capsules=[] if capsule is None else [capsule],
  134. )
  135.  
  136. according to your docs
  137. The default search order is (descending priority): 1. Folders in the folders parameter, 2. Override folders,
  138. 3. Capsules in the capsules parameter, 4. Game modules, 5. Chitin.
  139. Hmm I think we're overthinking. If !ReplaceFile=1, the assumption is that tslpatchdata 100% has the definition for the resource no?
  140. So the correct code should be:
  141. search_order = [
  142. SearchLocation.OVERRIDE,
  143. SearchLocation.CUSTOM_MODULES,
  144. SearchLocation.CUSTOM_FOLDERS,
  145. ]
  146. if gff_patch.replace_file:
  147. search_order = [
  148. SearchLocation.CUSTOM_FOLDERS,
  149. # remove CUSTOM_MODULES and CUSTOM_FOLDERS
  150. ]
  151. Wizard — Today at 12:28 AM
  152. Wait my apologies. Are you saying CUSTOM_MODULES refers to .mod files within tslpatchdata?
  153. Ahhhh everything you've said makes sense if that's the case.
  154. It seems I'm just slow sometimes
  155. I was thinking CUSTOM_MODULES refers to custom modules in the Modules folder of the installation, since .mod files are not provided with a vanilla installation
  156. Wait, no.......
  157. CUSTOM_MODULES = 12
  158. """Encapsulated resources stored in the capsules specified in method parameters."""
  159.  
  160. In order for that to make sense, we'd need to also change the definition of capsule as right now it's pointing to the Modules folder within the installation
  161. Cortisol — Today at 12:34 AM
  162. As it should...
  163. Wizard — Today at 12:35 AM
  164. But if I'm understanding, the order should be:
  165. if !ReplaceFile=0
  166. Then order should be Override, Modules, tslpatchdata
  167. if !ReplaceFile=1
  168. Then order should be tslpatchdata raw files, tslpatchdata .mod/.erf's, error
  169. Cortisol — Today at 12:35 AM
  170. That's why custom modules and override are paired together and are always in that order
  171. Wizard — Today at 12:35 AM
  172. Currently capsule is defined as the location of self.game_path / gff_patch.destination which could be the override or modules folder of the game installation
  173. Cortisol — Today at 12:36 AM
  174. Well technically replace file=true should be exclusively CUSTOM FOLDER then
  175. Since custom module and override are game files
  176. Wizard — Today at 12:37 AM
  177. Yeah that's what I'm getting at. But if CUSTOM_FOLDER is the only definition, will it know how to search .mod files within tslpatchdata?
  178. Cortisol — Today at 12:37 AM
  179. Idk
  180. Wizard — Today at 12:37 AM
  181. And if so, should the priority order be tslpatchdata .erf/.mod and THEN raw files within tslpatchdata?
  182. Cortisol — Today at 12:37 AM
  183. Can tslpatcher take files out of mod files in tslpatchdata
  184. I thought it only copies mod files, not resources inside
  185. Wizard — Today at 12:38 AM
  186. ahh i'm guessing it doesn't search .mod files within tslpatchdata, but i'll ask in some modding discords and deadlystream to be certain
  187. may i copy this conversation as a reference?
  188. Cortisol — Today at 12:39 AM
  189. Go for it
  190. DP is probably a good person to ask
  191. Wizard — Today at 12:39 AM
  192. I guess I need to figure out what installation.resource()'s priority order is when only CUSTOM_FOLDERS is defined. Does it first search .erf/.mod within that folder and then raw files or is it the other way around: that's the question to answer here.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement