Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Commit

Permalink
cint
Browse files Browse the repository at this point in the history
  Fixed ModFile::save
  Fixed Collection::addMod with explicit flag use
  Fixed Collection::ClearReferenceLog

CBash
  Fixed stack corruption when an orphaned or extra world cell was found in a mod (was freeing from the wrong pool)
  Fixed inability to continue reading a mod when any orphaned / extra record was encountered
  • Loading branch information
waruddar committed Sep 18, 2011
1 parent 3f94ce9 commit b2f6b7d
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 134 deletions.
Binary file modified CBash.suo
Binary file not shown.
12 changes: 6 additions & 6 deletions CBash/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ bool sameStr::operator()( const STRING s1, const STRING s2 ) const
void peek_around(unsigned char *position, UINT32 length)
{
for(SINT32 x = length; x > 0; x--)
printer("%02X ", (position)[-x]);
printf("%02X ", (position)[-x]);
for(UINT32 x = 0; x < length; x++)
printer("%02X ", (position)[x]);
printer("\n\n");
printf("%02X ", (position)[x]);
printf("\n\n");
for(SINT32 x = length; x > 0; x--)
printer("%c", (position)[-x]);
printf("%c", (position)[-x]);
for(UINT32 x = 0; x < length; x++)
printer("%c", (position)[x]);
printer("\n");
printf("%c", (position)[x]);
printf("\n");
}
#endif

Expand Down
116 changes: 48 additions & 68 deletions CBash/GRUPRecord.h

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions CBash/Oblivion/TES4File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@ SINT32 TES4File::Load(RecordOp &read_parser, RecordOp &indexer, std::vector<Form
default:
if(GRUPLabel == 0 && GRUPSize == 0)
{
printer("TES4File::Read: Warning - Unknown record group (%c%c%c%c) encountered in mod \"%s\". Bad file structure, zeros found past end of groups.\n", ((STRING)&GRUPLabel)[0], ((STRING)&GRUPLabel)[1], ((STRING)&GRUPLabel)[2], ((STRING)&GRUPLabel)[3], ModName);
printer("TES4File::Read: Warning - Mod \"%s\" contains an unknown record group (%c%c%c%c). Bad file structure, zeros found past end of groups.\n", ModName, ((STRING)&GRUPLabel)[0], ((STRING)&GRUPLabel)[1], ((STRING)&GRUPLabel)[2], ((STRING)&GRUPLabel)[3]);
return 1;
}
else
printer("TES4File::Read: Error - Unknown record group (%c%c%c%c) encountered in mod \"%s\". ", ((STRING)&GRUPLabel)[0], ((STRING)&GRUPLabel)[1], ((STRING)&GRUPLabel)[2], ((STRING)&GRUPLabel)[3], ModName);
printer("TES4File::Read: Error - Mod \"%s\" contains an unknown record group (%c%c%c%c).", ModName, ((STRING)&GRUPLabel)[0], ((STRING)&GRUPLabel)[1], ((STRING)&GRUPLabel)[2], ((STRING)&GRUPLabel)[3]);

if(GRUPSize == 0)
{
Expand Down
Binary file modified release/CBash.dll
Binary file not shown.
Binary file modified release/CBashExe.exe
Binary file not shown.
Binary file modified release/CBashExe.pdb
Binary file not shown.
52 changes: 34 additions & 18 deletions release/TemplateToFinal.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -440,16 +440,16 @@ SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString(" MGEFCODE_OR_UINT32_LISTMACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_OR_UINT32_LIST($2)");
SearchAndReplace.setSearchString(" MGEFCODE_LISTMACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_LIST($2)");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString(" OBMEMGEFCODE_OR_UINT32_LISTMACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_OR_UINT32_LIST($2) #OBME");
SearchAndReplace.setSearchString(" OBMEMGEFCODE_LISTMACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_LIST($2) #OBME");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
Expand Down Expand Up @@ -658,15 +658,15 @@ SearchAndReplace.replaceAll(view);

//Top Level Macros
SearchAndReplace.setSearchString("( *) SUBRECORD_MACRO\\((.*?), (.*?), (.*?), (.*?)(?!,)\\)");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self.GetParentMod()._ModID, cast($3, POINTER(c_ulong)).contents.value, formID.GetShortFormID(self._RecordID), EditorID, self._RecordID)\n$1 if(RecordID): return $5(RecordID)\n$1 return None\n$1 $2 = CBashSUBRECORD($4, $5, $3)\n");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self.GetParentMod()._ModID, cast($3, POINTER(c_ulong)).contents.value, formID.GetShortFormID(self), EditorID, self._RecordID)\n$1 if(RecordID): return $5(RecordID)\n$1 return None\n$1 $2 = CBashSUBRECORD($4, $5, $3)\n");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString("( *) SUBRECORD_ARRAY_MACRO\\((.*?), (.*?), (.*?), (.*?)(?!,)\\)");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self.GetParentMod()._ModID, cast($3, POINTER(c_ulong)).contents.value, formID.GetShortFormID(self._RecordID), EditorID, self._RecordID)\n$1 if(RecordID): return $5(RecordID)\n$1 return None\n$1 $2 = CBashSUBRECORDARRAY($4, $5, $3)\n");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self.GetParentMod()._ModID, cast($3, POINTER(c_ulong)).contents.value, formID.GetShortFormID(self), EditorID, self._RecordID)\n$1 if(RecordID): return $5(RecordID)\n$1 return None\n$1 $2 = CBashSUBRECORDARRAY($4, $5, $3)\n");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
Expand Down Expand Up @@ -849,16 +849,16 @@ SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString(" MGEFCODE_OR_UINT32_ARRAY_MACRO\\((.*?), (.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_OR_UINT32_ARRAY($2, $3)");
SearchAndReplace.setSearchString(" MGEFCODE_ARRAY_MACRO\\((.*?), (.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_ARRAY($2, $3)");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString(" MGEFCODE_OR_UINT32_ARRAY_MACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_OR_UINT32_ARRAY($2)");
SearchAndReplace.setSearchString(" MGEFCODE_ARRAY_MACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_ARRAY($2)");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
Expand Down Expand Up @@ -1146,31 +1146,31 @@ SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString("( *) ObModEDIDRecordsMACRO\\((.*?)\\)");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self._ModID, cast(\"$2\", POINTER(c_ulong)).contents.value, formID.GetShortFormID(_CGetRecordID(self._ModID, 0, 0)), EditorID, 0)\n$1 if(RecordID): return Ob$2Record(RecordID)\n$1 return None\n$1 $2 = CBashRECORDARRAY(Ob$2Record, \'$2\')\n");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self._ModID, cast(\"$2\", POINTER(c_ulong)).contents.value, formID.GetShortFormID(self), EditorID, 0)\n$1 if(RecordID): return Ob$2Record(RecordID)\n$1 return None\n$1 $2 = CBashRECORDARRAY(Ob$2Record, \'$2\')\n");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString("( *) FnvModEDIDRecordsMACRO\\((.*?)\\)");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self._ModID, cast(\"$2\", POINTER(c_ulong)).contents.value, formID.GetShortFormID(_CGetRecordID(self._ModID, 0, 0)), EditorID, 0)\n$1 if(RecordID): return Fnv$2Record(RecordID)\n$1 return None\n$1 $2 = CBashRECORDARRAY(Fnv$2Record, \'$2\')\n");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self._ModID, cast(\"$2\", POINTER(c_ulong)).contents.value, formID.GetShortFormID(self), EditorID, 0)\n$1 if(RecordID): return Fnv$2Record(RecordID)\n$1 return None\n$1 $2 = CBashRECORDARRAY(Fnv$2Record, \'$2\')\n");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString("( *) ObModRecordsMACRO\\((.*?)\\)");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self._ModID, cast(\"$2\", POINTER(c_ulong)).contents.value, formID.GetShortFormID(_CGetRecordID(self._ModID, 0, 0)), EditorID, 0)\n$1 if(RecordID): return Ob$2Record(RecordID)\n$1 return None\n$1 $2 = CBashRECORDARRAY(Ob$2Record, \'$2\')\n");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self._ModID, cast(\"$2\", POINTER(c_ulong)).contents.value, formID.GetShortFormID(self), EditorID, 0)\n$1 if(RecordID): return Ob$2Record(RecordID)\n$1 return None\n$1 $2 = CBashRECORDARRAY(Ob$2Record, \'$2\')\n");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString("( *) FnvModRecordsMACRO\\((.*?)\\)");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self._ModID, cast(\"$2\", POINTER(c_ulong)).contents.value, formID.GetShortFormID(_CGetRecordID(self._ModID, 0, 0)), EditorID, 0)\n$1 if(RecordID): return Fnv$2Record(RecordID)\n$1 return None\n$1 $2 = CBashRECORDARRAY(Fnv$2Record, \'$2\')\n");
SearchAndReplace.setReplaceString("$1 def create_$2(self, EditorID=0, formID=FormID(None, None)):\n$1 RecordID = _CCreateRecord(self._ModID, cast(\"$2\", POINTER(c_ulong)).contents.value, formID.GetShortFormID(self), EditorID, 0)\n$1 if(RecordID): return Fnv$2Record(RecordID)\n$1 return None\n$1 $2 = CBashRECORDARRAY(Fnv$2Record, \'$2\')\n");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
Expand Down Expand Up @@ -1241,6 +1241,14 @@ SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString(" SINT32_TYPE_EDIDMACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashGeneric($2, c_long)");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString(" UINT32_EDIDMACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashGeneric($2, c_ulong)");
SearchAndReplace.setBeanShellReplace(false);
Expand All @@ -1249,6 +1257,14 @@ SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString(" UINT32_TYPE_EDIDMACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashGeneric($2, c_ulong)");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString(" UINT16_EDIDMACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashGeneric($2, c_ushort)");
SearchAndReplace.setBeanShellReplace(false);
Expand All @@ -1257,16 +1273,16 @@ SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString(" MGEFCODE_OR_UINT32_ARRAY_EDIDMACRO\\((.*?), (.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_OR_UINT32_ARRAY($2, $3)");
SearchAndReplace.setSearchString(" MGEFCODE_ARRAY_EDIDMACRO\\((.*?), (.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_ARRAY($2, $3)");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);

SearchAndReplace.setSearchString(" MGEFCODE_OR_UINT32_ARRAY_EDIDMACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_OR_UINT32_ARRAY($2)");
SearchAndReplace.setSearchString(" MGEFCODE_ARRAY_EDIDMACRO\\((.*?), (.*?)\\)");
SearchAndReplace.setReplaceString(" $1 = CBashMGEFCODE_ARRAY($2)");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
Expand Down
43 changes: 23 additions & 20 deletions release/cint-template.py
Original file line number Diff line number Diff line change
Expand Up @@ -13375,7 +13375,7 @@ def save(self, CloseCollection=True, CleanMasters=True, DestinationName=None):
flags |= 0x00000001
if(CloseCollection):
flags |= 0x00000002
return _CSaveMod(self._ModID, c_ulong(flags), str(DestinationName))
return _CSaveMod(self._ModID, c_ulong(flags), DestinationName)

@property
def TES4(self):
Expand Down Expand Up @@ -13603,7 +13603,7 @@ def save(self, CloseCollection=True, CleanMasters=True, DestinationName=None):
flags |= 0x00000001
if(CloseCollection):
flags |= 0x00000002
return _CSaveMod(self._ModID, c_ulong(flags), str(DestinationName))
return _CSaveMod(self._ModID, c_ulong(flags), DestinationName)

@property
def TES4(self):
Expand Down Expand Up @@ -13845,7 +13845,7 @@ def UnloadAllCollections():
def DeleteAllCollections():
return _CDeleteAllCollections()

def addMod(self, FileName, MinLoad=True, NoLoad=False, IgnoreExisting=False, Saveable=True, LoadMasters=True, Flags=0x00000079):
def addMod(self, FileName, MinLoad=True, NoLoad=False, IgnoreExisting=False, Saveable=True, LoadMasters=True, Flags=None):
## //MinLoad and FullLoad are exclusive
## // If both are set, FullLoad takes priority
## // If neither is set, the mod isn't loaded
Expand Down Expand Up @@ -13892,8 +13892,7 @@ def addMod(self, FileName, MinLoad=True, NoLoad=False, IgnoreExisting=False, Sav
## //Only the following combinations are tested:
## // Normal: (fIsMinLoad or fIsFullLoad) + fIsInLoadOrder + fIsSaveable + fIsAddMasters + fIsLoadMasters
## // Merged: (fIsMinLoad or fIsFullLoad) + fIsSkipNewRecords + fIgnoreAbsentMasters
## // Scanned: (fIsMinLoad or fIsFullLoad) + fIsSkipNewRecords + fIsExtendedConflicts

## // Scanned: (fIsMinLoad or fIsFullLoad) + fIsSkipNewRecords + fIgnoreAbsentMasters + fIsExtendedConflicts
fIsMinLoad = 0x00000001
fIsFullLoad = 0x00000002
fIsSkipNewRecords = 0x00000004
Expand All @@ -13908,10 +13907,24 @@ def addMod(self, FileName, MinLoad=True, NoLoad=False, IgnoreExisting=False, Sav
fIsIgnoreExisting = 0x00000800
fIsIgnoreAbsentMasters = 0x00001000

if IgnoreExisting:
Flags |= fIsIgnoreExisting
else:
Flags &= ~fIsIgnoreExisting
if Flags is None:
Flags = fIsMinLoad | fIsInLoadOrder | fIsSaveable | fIsAddMasters | fIsLoadMasters

if IgnoreExisting:
Flags |= fIsIgnoreExisting
else:
Flags &= ~fIsIgnoreExisting

if Saveable:
Flags |= fIsSaveable
else:
Flags &= ~fIsSaveable

if LoadMasters:
Flags |= fIsLoadMasters
else:
Flags &= ~fIsLoadMasters

if NoLoad:
Flags &= ~fIsFullLoad
Flags &= ~fIsMinLoad
Expand All @@ -13922,16 +13935,6 @@ def addMod(self, FileName, MinLoad=True, NoLoad=False, IgnoreExisting=False, Sav
Flags |= fIsFullLoad
Flags &= ~fIsMinLoad

if Saveable:
Flags |= fIsSaveable
else:
Flags &= ~fIsSaveable

if LoadMasters:
Flags |= fIsLoadMasters
else:
Flags &= ~fIsLoadMasters

_CAddMod(self._CollectionID, str(FileName), Flags)
return None

Expand Down Expand Up @@ -13986,7 +13989,7 @@ def UpdateReferences(self, OldFormIDs, NewFormIDs):
return sum([mod.UpdateReferences(OldFormIDs, NewFormIDs) for mod in self.LoadOrderMods])

def ClearReferenceLog(self):
return _CGetRecordUpdatedReferences(0, self._CollectionID)
return _CGetRecordUpdatedReferences(self._CollectionID, 0)

def Debug_DumpModFiles(self):
value = _("Collection (%08X) contains the following modfiles:\n") % (self._CollectionID,)
Expand Down
Loading

0 comments on commit b2f6b7d

Please sign in to comment.