Jump to content

File/Folder Change Case for Other OS


Recommended Posts

Posted

For transferring game + mods over to Unix like or Steam Deck. Beta testers please:

Posted (edited)

Hi, Imsteam!  Posted regarding this in the Coffee House threads on Steam.  (The various Coffee threads are frequented by a number of experienced, knowledgeable, and reliable individuals, so hopefully there will be at least some people from them who are willing to test.)

Old Farts Coffee House (SSE)
The Coffee Pod (Starfield)
Ilja's Forum Works and Coffee Room (Classic Skyrim)
Commonwealth Coffee Shelter (Fallout 4)

As well as in my Helpful Links, References, and News in the Nexus Starfield forum.
https://forums.nexusmods.com/topic/13203033-helpful-links-references-and-news/?do=findComment&comment=130477296

Post:

"Over on AFK Mods, Beta testers are needed for a tool by Imsteam that is designed for transferring game + mods over to Unix like or Steam Deck.  See:

https://www.afkmods.com/index.php?/topic/10314-filefolder-change-case-for-other-os/ "

Good luck on this project!

 

Edited by smr1957
Posted

There's one other aspect to all of this that would be nice for someone with xEdit scripting experience to tackle. Changing the MAST entries in plugins into lowercase for whichever masters for them have already been converted to lowercase. The guy I discussed all of this with on the LOOT server said the headers also need to be changed because they case the game to look up those filenames in whatever case they're in.

Posted

Thanks @smr1957, hopefully it'll help anyone wanting to run older games like F03 through apps like Wine or Winlator too. Presumably apps like Lutris handle case issues in game downloads from CDNs, not a lot of info in their docs about it though.

The big milestone for this much vaunted AI is the ability to convert all these cmd scripts over to Bash, retaining full functionality, and adding to the convenience of mod management on these systems.

 

The MAST issue sounds like something @hlp might have helped with back in the day, failing that, it's to go dusting off the PASCAL hat and glasses again. :P

Posted

Me or Zilav ? He wrote so many more scripts that I did and I haven't written one in literally years.

 

The core of the script would be :

SetEditValue(m, LowerCase(GetEditValue(m)));

once you manage to loop through the members of the MAST record in the m variable by modifying another script that deals with array.

Posted
9 hours ago, hlp said:

literally years.

Ha! Verily it has been! It's fair to say Zilav or anyone from the XEdit team could whip one up in a matter of hours if not minutes, could well be a tad longer over this way. Thanks for the heads up! :)

  • 1 month later...
Posted (edited)

Ok, @hlp cobbled up a smidge of something here, anything you can offer to bring it to life:

Not sure if the use of MASTSubRecord makes any sense, and will the array of s1Elems containing lcField be ever called upon?

Not convinced either if these changes will pass IsEditable.

Godbolt doesn't like "function Initialize: integer". :P

 

Spoiler
{
  New script template, only shows processed records
  Assigning any nonzero value to Result will terminate script
}
unit userscript;

// Called before processing
// You can remove it if script doesn't require initialization code
function Initialize: integer;
begin
  Result := 0;
end;
function Initialize: integer;
begin
  Result := 0;
end;

// called for every record selected in xEdit
function Process(e: IInterface): integer;
var
  slElems: TStringList;
  MASTSubRecord: IInterface;
  e1: IInterface;
  i,j: integer;
  s, lcField: string;
  plugin: IInterface;
  begin
  // for i := 0 to FileCount - 1 do begin
  for i := 0 to 1 do begin
  plugin := FileByIndex(i);

    // s1Elems: Array [0..15] of String;
    // Format of each subrecord of Master Files: Master File #0 Master File #1
    // (wbRecord)TES4 \ Master Files \ Master File \ MAST - FileName

  slElems := TStringList.Create;
  // iterate over all elements in override
  for j := 0 to Pred(ElementCount(plugin)) do begin
  e1 := ElementByIndex(plugin, j);  
  if Signature(e1) = 'TES4' then begin
  
  // e1 := DefType(plugin);
  // AddMessage('Is there a value of e1: ' + e1);
  s := name(e1);
  AddMessage('Print value of e1: ' + s);
  if s = 'MAST' then begin
  // Loop through wbRecord(TES4)

  // wbRArray('Master Files', wbRStruct('Master File', [
  // wbString(MAST, 'Filename', 0, cpNormal, True),
  // wbByteArray(DATA, 'Unused', 8, cpIgnore, True)], [])(.
  // IncludeFlag(dfInternalEditOnly, not wbAllowMasterFilesEdit)

  lcField := ElementByPath(plugin, 'MAST');
    // slElems.Add(lcField);
  AddMessage('Processing: ' + lcField);
  AddMessage('Processing: ' + s);
  SetEditValue(MASTSubRecord, LowerCase(lcField));
  // SetEditValue(MASTSubRecord, LowerCase(GetEditValue(MASTSubRecord)));


  // Copy the contents of one element into a container element, or create and append an element to a container. aeContainer Destination element. aiIndex Where to place the new element, if the destination is an array. Specify HighInteger to append. Specify LowInteger or a negative value to add to non-arrays. aeSource Element to copy from. Use Nil to create a blank element of the appropriate type. abOnlySK Sorted Key Only; : Only apply to elements participating in container sorting, for internal xEdit usage. Use False. Sample: there is a script to copy VMAD subrecords "Skyrim - Copy VMAD subrecord.pas"</summary>
  // ElementAssign(ElementBySignature(plugin, 'MAST'), Lowinteger, MASTSubRecord, False)
  end
  end;

/// Finds the element within aeContainer specified by asPath, and sets its value based on the string representation asValue.</summary>
/// aeContainer: Container of elements
/// asPath: Path to element to change
/// asValue: Text value to set
/// SetElementEditValues(aeContainer: IwbContainer; asPath: string; asValue: string);


  // comment this out if you don't want those messages
  // AddMessage('Processing: ' + FullPath(e));

end;
end;
end;

// May require this
function IsEditable(aeElement: IwbElement): boolean;

  if IsEditable(e) and not GetIsDeleted(e) then begin
      
        // Check if the element exists and add if necessary
        if ElementCount(ElementByName(e, sKWDA)) > 0 then begin
          if not Assigned(ElementByName(e, sKSIZ)) then begin

  Result := 0;
end;
end;
end;
end.

 

Thanks. :)

 

Edited by lmstearn
update code
  • 3 weeks later...
Posted (edited)

If you're simply trying to change the MAST filenames of all loaded files. This simple script will do it. If you need to change the filenames of other things (models, textures, etc) then lots of other code needs to be done to facilitate that.

If everything is using archives (ba2/bsa) then the filename case in the plugin for assets won't matter. Because the resolver for files in archives will handle it for you. It would only be a potential concern for loose files.

 

ToLowerMAST.pas

Edited by jostrus
  • 3 weeks later...
Posted

Latest update clears a few bugs, a few more items of interest on the description, including:

Quote

The 1.1 Gamma releases include logs LC and UC for a basic SkyrimSE Steam install,
with just SKSE and the Unofficial Patches, 30,832 files in all. As can be seen from the logs,
the time taken to rename the files and folders to lower case was just over 20 seconds,
the time to rename the files and folders to upper case was around 35 minutes on the HDD!
The longer time in the latter would also apply to proper case file/folder renaming,
which also uses slow character by character comparisons and substitutions in loops,
thus demonstrating the limitations of the CMD batch language in performing this task.

For considerations of hardware and time expenditure,

the renaming of a large number of files and folders

to upper or proper case is not recommended here.

Say no more. :P

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...