mirror of
https://github.com/sfall-team/int2ssl.git
synced 2026-07-27 16:52:42 -07:00
stdafx removed
This commit is contained in:
@@ -18,7 +18,6 @@ ObjectAttributes.h
|
||||
Opcode.h
|
||||
ProcTable.h
|
||||
StartupCode.h
|
||||
stdafx.h
|
||||
Utility.h
|
||||
XGetopt.h
|
||||
FalloutScript.cpp
|
||||
@@ -32,7 +31,6 @@ OpcodeAttributes.cpp
|
||||
Opcode.cpp
|
||||
ProcTable.cpp
|
||||
StartupCode.cpp
|
||||
stdafx.cpp
|
||||
Utility.cpp
|
||||
XGetopt.cpp
|
||||
)
|
||||
|
||||
+30
-32
@@ -11,7 +11,6 @@
|
||||
#include <iostream>
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "FalloutScript.h"
|
||||
|
||||
// Third party includes
|
||||
@@ -49,10 +48,10 @@ void CFalloutScript::Serialize(CArchive& ar)
|
||||
uint32_t ullCurrentOffset = ar.GetFile()->GetPosition();
|
||||
|
||||
// Load globals
|
||||
m_GlobalVar.RemoveAll();
|
||||
m_ExportedVar.RemoveAll();
|
||||
m_ExportedVarValue.RemoveAll();
|
||||
m_ExportedProc.RemoveAll();
|
||||
m_GlobalVar.clear();
|
||||
m_ExportedVar.clear();
|
||||
m_ExportedVarValue.clear();
|
||||
m_ExportedProc.clear();
|
||||
|
||||
COpcodeArray HeaderTail;
|
||||
|
||||
@@ -60,24 +59,24 @@ void CFalloutScript::Serialize(CArchive& ar)
|
||||
{
|
||||
opcode.Serialize(ar);
|
||||
ullCurrentOffset += opcode.GetSize();
|
||||
HeaderTail.Add(opcode);
|
||||
HeaderTail.push_back(opcode);
|
||||
}
|
||||
|
||||
// Jump to 'start' procedure
|
||||
std::cout << " Check \"Jump to \'start\' procedure\" / \"Jump to end of statup code\"" << std::endl;
|
||||
|
||||
if (!HeaderTail.IsEmpty())
|
||||
if (!HeaderTail.empty())
|
||||
{
|
||||
int32_t nIndexOfStart = GetIndexOfProc("start");
|
||||
uint32_t ulStartProcAddress = (nIndexOfStart != -1) ? m_ProcTable[nIndexOfStart].m_ulBodyOffset : 18;
|
||||
|
||||
opcode = HeaderTail[HeaderTail.GetUpperBound()];
|
||||
opcode = HeaderTail.back();
|
||||
|
||||
if (opcode.GetOperator() == COpcode::O_JMP)
|
||||
{
|
||||
HeaderTail.RemoveAt(HeaderTail.GetUpperBound());
|
||||
HeaderTail.pop_back();
|
||||
|
||||
if (HeaderTail.IsEmpty())
|
||||
if (HeaderTail.empty())
|
||||
{
|
||||
printf("\n");
|
||||
printf("Warning: Omitted address of jump\n");
|
||||
@@ -85,11 +84,11 @@ void CFalloutScript::Serialize(CArchive& ar)
|
||||
}
|
||||
else
|
||||
{
|
||||
opcode = HeaderTail[HeaderTail.GetUpperBound()];
|
||||
opcode = HeaderTail.back();
|
||||
|
||||
if (opcode.GetOperator() == COpcode::O_INTOP)
|
||||
{
|
||||
HeaderTail.RemoveAt(HeaderTail.GetUpperBound());
|
||||
HeaderTail.pop_back();
|
||||
|
||||
if (opcode.GetArgument() != ulStartProcAddress)
|
||||
{
|
||||
@@ -119,21 +118,21 @@ void CFalloutScript::Serialize(CArchive& ar)
|
||||
|
||||
std::string strNumOfArgsWarning = "Warning: Omitted \"# of argument to \'start\' procedure\"\n";
|
||||
|
||||
if (!HeaderTail.IsEmpty())
|
||||
if (!HeaderTail.empty())
|
||||
{
|
||||
opcode = HeaderTail[HeaderTail.GetUpperBound()];
|
||||
opcode = HeaderTail.back();
|
||||
|
||||
if (opcode.GetOperator() == COpcode::O_CRITICAL_DONE)
|
||||
{
|
||||
HeaderTail.RemoveAt(HeaderTail.GetUpperBound());
|
||||
HeaderTail.pop_back();
|
||||
|
||||
if (!HeaderTail.IsEmpty())
|
||||
if (!HeaderTail.empty())
|
||||
{
|
||||
opcode = HeaderTail[HeaderTail.GetUpperBound()];
|
||||
opcode = HeaderTail.back();
|
||||
|
||||
if (opcode.HasArgument())
|
||||
{
|
||||
HeaderTail.RemoveAt(HeaderTail.GetUpperBound());
|
||||
HeaderTail.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -178,7 +177,7 @@ void CFalloutScript::Serialize(CArchive& ar)
|
||||
// Global variables
|
||||
printf(" Extract \"Global variables\" section\n");
|
||||
|
||||
for(int32_t i = 0; i < HeaderTail.GetSize(); i++)
|
||||
for(int32_t i = 0; i < HeaderTail.size(); i++)
|
||||
{
|
||||
uint16_t wGlobalVarOperator = HeaderTail[i].GetOperator();
|
||||
|
||||
@@ -190,15 +189,15 @@ void CFalloutScript::Serialize(CArchive& ar)
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
m_GlobalVar.Add(HeaderTail[i]);
|
||||
m_GlobalVar.push_back(HeaderTail[i]);
|
||||
}
|
||||
|
||||
// Procedures bodyes
|
||||
printf(" Read procedure\'s bodies\n");
|
||||
m_ProcBodies.RemoveAll(); // Destroy old data
|
||||
m_Conditions.RemoveAll();
|
||||
m_ProcBodies.SetSize(m_ProcTable.GetSize());
|
||||
m_Conditions.SetSize(m_ProcTable.GetSize());
|
||||
m_ProcBodies.clear(); // Destroy old data
|
||||
m_Conditions.clear();
|
||||
m_ProcBodies.resize(m_ProcTable.GetSize());
|
||||
m_Conditions.resize(m_ProcTable.GetSize());
|
||||
|
||||
CNode node;
|
||||
|
||||
@@ -214,7 +213,7 @@ void CFalloutScript::Serialize(CArchive& ar)
|
||||
{
|
||||
node.m_Opcode.Serialize(ar);
|
||||
node.m_ulOffset = ulOffset;
|
||||
m_ProcBodies[i].Add(node);
|
||||
m_ProcBodies[i].push_back(node);
|
||||
ulOffset += node.m_Opcode.GetSize();
|
||||
}
|
||||
}
|
||||
@@ -224,7 +223,7 @@ void CFalloutScript::ExtractCodeElements(COpcodeArray& Source, COpcodeArray& Des
|
||||
{
|
||||
int32_t i = 0;
|
||||
|
||||
for(; i < Source.GetSize(); i++)
|
||||
for(; i < Source.size(); i++)
|
||||
{
|
||||
if (Source[i].GetOperator() == wDelimeter)
|
||||
{
|
||||
@@ -232,7 +231,7 @@ void CFalloutScript::ExtractCodeElements(COpcodeArray& Source, COpcodeArray& Des
|
||||
}
|
||||
}
|
||||
|
||||
if (i < Source.GetSize())
|
||||
if (i < Source.size())
|
||||
{
|
||||
if (i < nSizeOfCodeItem - 1)
|
||||
{
|
||||
@@ -253,14 +252,13 @@ void CFalloutScript::ExtractCodeElements(COpcodeArray& Source, COpcodeArray& Des
|
||||
|
||||
for(int32_t j = 0; j < nSizeOfCodeItem - 1; j++)
|
||||
{
|
||||
Destination.Add(Source[i - nSizeOfCodeItem + 1]);
|
||||
Source.RemoveAt(i - nSizeOfCodeItem + 1);
|
||||
Destination.push_back(Source[i - nSizeOfCodeItem + 1]);
|
||||
Source.erase(Source.begin() + i - nSizeOfCodeItem + 1);
|
||||
}
|
||||
|
||||
Source.RemoveAt(i - nSizeOfCodeItem + 1); // Delimeter
|
||||
Source.erase(Source.begin() + i - nSizeOfCodeItem + 1); // Delimeter
|
||||
|
||||
|
||||
if (i > Source.GetUpperBound())
|
||||
if (i > Source.size() - 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
+51
-53
@@ -12,7 +12,6 @@
|
||||
#include <algorithm>
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "FalloutScript.h"
|
||||
#include "ObjectAttributes.h"
|
||||
#include "Utility.h"
|
||||
@@ -48,7 +47,7 @@ void CFalloutScript::InitDefinitions()
|
||||
}
|
||||
}
|
||||
|
||||
m_GlobalVarsNames.resize(m_GlobalVar.GetSize());
|
||||
m_GlobalVarsNames.resize(m_GlobalVar.size());
|
||||
|
||||
for(int32_t i = 0; i < m_GlobalVarsNames.size(); i++)
|
||||
{
|
||||
@@ -78,7 +77,7 @@ void CFalloutScript::ProcessCode()
|
||||
ExtractAndReduceCondition(m_ProcBodies[i], m_Conditions[i], 0);
|
||||
}
|
||||
|
||||
for(int32_t j = 0; j < m_ProcBodies[i].GetSize(); j++)
|
||||
for(int32_t j = 0; j < m_ProcBodies[i].size(); j++)
|
||||
{
|
||||
if (m_ProcBodies[i][j].m_Opcode.GetOperator() == COpcode::O_CALL_CONDITION)
|
||||
{
|
||||
@@ -166,7 +165,7 @@ int32_t CFalloutScript::GetIndexOfExportedVariable(uint32_t ulNameOffset)
|
||||
{
|
||||
int32_t nResult = -1;
|
||||
|
||||
for(int32_t i = 0; i < m_ExportedVarValue.GetSize(); i += 2)
|
||||
for(int32_t i = 0; i < m_ExportedVarValue.size(); i += 2)
|
||||
{
|
||||
if (m_ExportedVarValue[i + 1].GetArgument() == ulNameOffset)
|
||||
{
|
||||
@@ -192,7 +191,7 @@ void CFalloutScript::TryRenameGlobalVariables()
|
||||
{
|
||||
int32_t nNamesCount = m_Namespace.GetSize();
|
||||
int32_t nDefinitionsCount = m_Definitions.GetSize();
|
||||
int32_t nGlobalVarCount = m_GlobalVar.GetSize();
|
||||
int32_t nGlobalVarCount = m_GlobalVar.size();
|
||||
|
||||
CDefObject defObject;
|
||||
int32_t nGlobalVarIndex = 0;
|
||||
@@ -220,7 +219,7 @@ void CFalloutScript::TryRenameImportedVariables()
|
||||
CDefObject defObject;
|
||||
uint32_t ulNameOffset;
|
||||
|
||||
if (m_GlobalVar.GetSize() == 0)
|
||||
if (m_GlobalVar.size() == 0)
|
||||
{
|
||||
for(int32_t i = 0; i < m_Namespace.GetSize(); i++)
|
||||
{
|
||||
@@ -238,7 +237,7 @@ int32_t CFalloutScript::NextNodeIndex( CNodeArray& NodeArray, int32_t nCurrentIn
|
||||
{
|
||||
int32_t nResult = nCurrentIndex + nStep;
|
||||
|
||||
if ((nResult < 0) || (nResult > NodeArray.GetUpperBound()))
|
||||
if ((nResult < 0) || (nResult >= NodeArray.size()))
|
||||
{
|
||||
printf("Error: Index of node out of range\n");
|
||||
throw std::exception();
|
||||
@@ -266,7 +265,7 @@ bool CFalloutScript::RemoveSequenceOfNodes(CNodeArray& NodeArray, int32_t nStart
|
||||
}
|
||||
}
|
||||
|
||||
NodeArray.RemoveAt(nStartIndex, nCount);
|
||||
NodeArray.erase(NodeArray.begin() + nStartIndex, NodeArray.begin() + nStartIndex + nCount);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -336,15 +335,15 @@ void CFalloutScript::InitialReduce()
|
||||
uint16_t* pwCode;
|
||||
int32_t nCount;
|
||||
|
||||
for(int32_t i = 0 ; i < m_ProcBodies.GetSize(); i++)
|
||||
for(int32_t i = 0 ; i < m_ProcBodies.size(); i++)
|
||||
{
|
||||
// Tail
|
||||
if (!m_ProcBodies[i].IsEmpty())
|
||||
if (!m_ProcBodies[i].empty())
|
||||
{
|
||||
pwCode = (m_ProcTable[i].m_ulType & P_CRITICAL) ? awTailOfCriticalProc : awTailOfProc;
|
||||
nCount = (m_ProcTable[i].m_ulType & P_CRITICAL) ? 4 : 3;
|
||||
|
||||
if (!RemoveSequenceOfNodes(m_ProcBodies[i], m_ProcBodies[i].GetSize() - nCount, nCount, pwCode, nCount))
|
||||
if (!RemoveSequenceOfNodes(m_ProcBodies[i], m_ProcBodies[i].size() - nCount, nCount, pwCode, nCount))
|
||||
{
|
||||
printf("Error: Invalid tail of procedure\'s body\n");
|
||||
throw std::exception();
|
||||
@@ -352,7 +351,7 @@ void CFalloutScript::InitialReduce()
|
||||
}
|
||||
|
||||
// Body
|
||||
for(int32_t j = 0; j < m_ProcBodies[i].GetSize(); j++)
|
||||
for(int32_t j = 0; j < m_ProcBodies[i].size(); j++)
|
||||
{
|
||||
switch(m_ProcBodies[i][j].m_Opcode.GetOperator())
|
||||
{
|
||||
@@ -377,10 +376,10 @@ void CFalloutScript::InitialReduce()
|
||||
}
|
||||
while (skipOffset > m_ProcBodies[i][k].m_ulOffset);
|
||||
|
||||
m_ProcBodies[i].InsertAt(k, m_ProcBodies[i][j]);
|
||||
m_ProcBodies[i].insert(m_ProcBodies[i].begin() + k, m_ProcBodies[i][j]);
|
||||
m_ProcBodies[i][k].m_Opcode.SetOperator(actualOperator); // place AND/OR here, so BuildTree() will treat it as a regular binary operator
|
||||
m_ProcBodies[i][k].m_ulOffset = m_ProcBodies[i][k-1].m_ulOffset + COpcode::OPERATOR_SIZE; // adjust offset
|
||||
m_ProcBodies[i].RemoveAt(j, (actualOperator == COpcode::O_AND) ? 5 : 6); // reduce
|
||||
m_ProcBodies[i].erase(m_ProcBodies[i].begin() + j, m_ProcBodies[i].begin() + j + (actualOperator == COpcode::O_AND ? 5 : 6)); // reduce
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -422,7 +421,7 @@ uint32_t CFalloutScript::BuildTreeBranch(CNodeArray& NodeArray, uint32_t nStartI
|
||||
|
||||
COpcode::COpcodeAttributes opcodeAttributes;
|
||||
int32_t j;
|
||||
for (j = nStartIndex; (j < NodeArray.GetSize() && NodeArray[j].m_ulOffset < ulEndOffset); j++)
|
||||
for (j = nStartIndex; (j < NodeArray.size() && NodeArray[j].m_ulOffset < ulEndOffset); j++)
|
||||
{
|
||||
wOperator = NodeArray[j].m_Opcode.GetOperator();
|
||||
ulArgument = NodeArray[j].m_Opcode.GetArgument();
|
||||
@@ -519,19 +518,19 @@ uint32_t CFalloutScript::BuildTreeBranch(CNodeArray& NodeArray, uint32_t nStartI
|
||||
{
|
||||
if (k < nOmittedArgStartIndex)
|
||||
{
|
||||
NodeArray[j].m_Arguments.InsertAt(0, NodeArray[j-1]);
|
||||
NodeArray.RemoveAt(j - 1);
|
||||
NodeArray[j].m_Arguments.insert(NodeArray[j].m_Arguments.begin() + 0, NodeArray[j-1]);
|
||||
NodeArray.erase(NodeArray.begin() + j - 1);
|
||||
j--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_bInsOmittedArgsBackward)
|
||||
{
|
||||
NodeArray[j].m_Arguments.Add(CNode(CNode::TYPE_OMITTED_ARGUMENT));
|
||||
NodeArray[j].m_Arguments.push_back(CNode(CNode::TYPE_OMITTED_ARGUMENT));
|
||||
}
|
||||
else
|
||||
{
|
||||
NodeArray[j].m_Arguments.InsertAt(0, CNode(CNode::TYPE_OMITTED_ARGUMENT));
|
||||
NodeArray[j].m_Arguments.insert(NodeArray[j].m_Arguments.begin() + 0, CNode(CNode::TYPE_OMITTED_ARGUMENT));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -551,10 +550,10 @@ uint32_t CFalloutScript::BuildTreeBranch(CNodeArray& NodeArray, uint32_t nStartI
|
||||
if (NodeArray[ulElseIndex - 2].IsExpression() && NodeArray[ulSkipIndex - 1].IsExpression())
|
||||
{ // conditional expression
|
||||
NodeArray[j].m_Type = CNode::TYPE_CONDITIONAL_EXPRESSION;
|
||||
NodeArray[j].m_Arguments.RemoveAt(0); // address not needed anymore
|
||||
NodeArray[j].m_Arguments.InsertAt(0, NodeArray[ulElseIndex - 2]); // true expression
|
||||
NodeArray[j].m_Arguments.InsertAt(2, NodeArray[ulSkipIndex - 1]); // false expression
|
||||
NodeArray.RemoveAt(j + 1, ulSkipIndex - j - 1);
|
||||
NodeArray[j].m_Arguments.erase(NodeArray[j].m_Arguments.begin() + 0); // address not needed anymore
|
||||
NodeArray[j].m_Arguments.insert(NodeArray[j].m_Arguments.begin() + 0, NodeArray[ulElseIndex - 2]); // true expression
|
||||
NodeArray[j].m_Arguments.insert(NodeArray[j].m_Arguments.begin() + 2, NodeArray[ulSkipIndex - 1]); // false expression
|
||||
NodeArray.erase(NodeArray.begin() + j + 1, NodeArray.begin() + j + 1 + ulSkipIndex - j - 1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -568,9 +567,9 @@ uint32_t CFalloutScript::BuildTreeBranch(CNodeArray& NodeArray, uint32_t nStartI
|
||||
|
||||
void CFalloutScript::BuildTree(CNodeArray& NodeArray)
|
||||
{
|
||||
if (NodeArray.GetSize() > 0)
|
||||
if (NodeArray.size() > 0)
|
||||
{
|
||||
BuildTreeBranch(NodeArray, 0, NodeArray[NodeArray.GetSize() - 1].m_ulOffset + COpcode::OPERATOR_SIZE);
|
||||
BuildTreeBranch(NodeArray, 0, NodeArray[NodeArray.size() - 1].m_ulOffset + COpcode::OPERATOR_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,7 +603,7 @@ void CFalloutScript::ExtractAndReduceCondition(CNodeArray& Source, CNodeArray& D
|
||||
}
|
||||
while(node.m_ulOffset < ulJumpOffset);
|
||||
|
||||
Destination.SetSize(nNodeIndex - nStartIndex);
|
||||
Destination.resize(nNodeIndex - nStartIndex);
|
||||
|
||||
for(int32_t j = 0; j < nNodeIndex - nStartIndex; j++)
|
||||
{
|
||||
@@ -630,14 +629,14 @@ void CFalloutScript::ExtractAndReduceCondition(CNodeArray& Source, CNodeArray& D
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
if (!RemoveSequenceOfNodes(Destination, Destination.GetSize() - 2, 2, awCleanupOfCondition, 2))
|
||||
if (!RemoveSequenceOfNodes(Destination, Destination.size() - 2, 2, awCleanupOfCondition, 2))
|
||||
{
|
||||
printf("Error: Invalid cleanup of condition\n");
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
// Check condition
|
||||
if (Destination.GetSize() != 1)
|
||||
if (Destination.size() != 1)
|
||||
{
|
||||
printf("Error: Invalid condition. Only one expression allowed\n");
|
||||
throw std::exception();
|
||||
@@ -652,12 +651,12 @@ void CFalloutScript::ExtractAndReduceCondition(CNodeArray& Source, CNodeArray& D
|
||||
}
|
||||
|
||||
// Remove from source
|
||||
Source.RemoveAt(nStartIndex, nNodeIndex - nStartIndex);
|
||||
Source.erase(Source.begin() + nStartIndex, Source.begin() + nStartIndex + nNodeIndex - nStartIndex);
|
||||
}
|
||||
|
||||
void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
{
|
||||
if (NodeArray.IsEmpty())
|
||||
if (NodeArray.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -673,7 +672,7 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
}
|
||||
|
||||
// End of procedure
|
||||
int32_t nLastNodeIndex = NodeArray.GetUpperBound();
|
||||
int32_t nLastNodeIndex = NodeArray.size() ? NodeArray.size() - 1 : 0;
|
||||
|
||||
if ((NodeArray[nLastNodeIndex].m_Opcode.GetOperator() == COpcode::O_POP_RETURN) &&
|
||||
(NodeArray[nLastNodeIndex].m_Opcode.GetArgument() == 0) &&
|
||||
@@ -686,14 +685,14 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
else
|
||||
{
|
||||
ulOffset = NodeArray[nLastNodeIndex].m_ulOffset;
|
||||
NodeArray.InsertAt(nLastNodeIndex + 1, CNode(c_NodeEndOfBlock));
|
||||
NodeArray.insert(NodeArray.begin() + nLastNodeIndex + 1, CNode(c_NodeEndOfBlock));
|
||||
NodeArray[nLastNodeIndex].m_ulOffset = ulOffset;
|
||||
}
|
||||
|
||||
// Body
|
||||
CNode node;
|
||||
|
||||
for(int32_t i = 0; i < NodeArray.GetSize(); i++)
|
||||
for(int32_t i = 0; i < NodeArray.size(); i++)
|
||||
{
|
||||
switch(NodeArray[i].m_Opcode.GetOperator())
|
||||
{
|
||||
@@ -708,17 +707,16 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
NodeArray.InsertAt(i + 1, CNode(c_NodeBeginOfBlock));
|
||||
NodeArray.insert(NodeArray.begin() + i + 1, CNode(c_NodeBeginOfBlock));
|
||||
NodeArray[i + 1].m_ulOffset = NodeArray[i].m_ulOffset;
|
||||
ulOffset = node.m_Opcode.GetArgument();
|
||||
|
||||
int32_t nNodeIndex = i + 1;
|
||||
CArray <int32_t, int32_t&> jumps;
|
||||
|
||||
std::vector<int32_t> jumps;
|
||||
do
|
||||
{
|
||||
node = NodeArray[nNodeIndex = NextNodeIndex(NodeArray, nNodeIndex, 1)];
|
||||
if (node.m_Opcode.GetOperator() == COpcode::O_JMP && node.m_Type == CNode::TYPE_NORMAL && node.m_Arguments.GetSize() > 0)
|
||||
if (node.m_Opcode.GetOperator() == COpcode::O_JMP && node.m_Type == CNode::TYPE_NORMAL && node.m_Arguments.size() > 0)
|
||||
{
|
||||
uint32_t ofs = node.m_Arguments[0].m_Opcode.GetArgument();
|
||||
if (ofs == ulOffset)
|
||||
@@ -731,17 +729,17 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
}
|
||||
else
|
||||
{
|
||||
jumps.Add(nNodeIndex);
|
||||
jumps.push_back(nNodeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
while(node.m_ulOffset < ulOffset);
|
||||
|
||||
bool isForLoop = false;
|
||||
if (NodeArray[nNodeIndex - 2].m_Arguments.GetSize() > 0 && i > 0)
|
||||
if (NodeArray[nNodeIndex - 2].m_Arguments.size() > 0 && i > 0)
|
||||
{ // *might* be a "for" loop
|
||||
loopOffset = NodeArray[nNodeIndex - 2].GetTopOffset();
|
||||
for (int32_t j=0; j<jumps.GetSize(); j++)
|
||||
for (int32_t j=0; j<jumps.size(); j++)
|
||||
{
|
||||
if (NodeArray[jumps[j]].m_Arguments[0].m_Opcode.GetArgument() == loopOffset)
|
||||
{ // jump points to the last statement in loop
|
||||
@@ -751,7 +749,7 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
}
|
||||
}
|
||||
|
||||
NodeArray.InsertAt(nNodeIndex, CNode(c_NodeEndOfBlock));
|
||||
NodeArray.insert(NodeArray.begin() + nNodeIndex, CNode(c_NodeEndOfBlock));
|
||||
NodeArray[nNodeIndex].m_ulOffset = NodeArray[nNodeIndex + 1].m_ulOffset;
|
||||
|
||||
node = NodeArray[nNodeIndex - 1];
|
||||
@@ -772,14 +770,14 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
{
|
||||
NodeArray[i].m_Type = CNode::TYPE_FOR_LOOP;
|
||||
NodeArray[i].m_Arguments[0] = NodeArray[i - 1]; // "for" initializer
|
||||
NodeArray[i].m_Arguments.Add(NodeArray[nNodeIndex - 2]); // "for" increment
|
||||
NodeArray.RemoveAt(i - 1); // eat statement before "while"
|
||||
NodeArray.RemoveAt(nNodeIndex - 3, 2); // eat last statement in loop along with jmp
|
||||
NodeArray[i].m_Arguments.push_back(NodeArray[nNodeIndex - 2]); // "for" increment
|
||||
NodeArray.erase(NodeArray.begin() + i - 1); // eat statement before "while"
|
||||
NodeArray.erase(NodeArray.begin() + nNodeIndex - 3, NodeArray.begin() + nNodeIndex - 3 + 2); // eat last statement in loop along with jmp
|
||||
}
|
||||
else
|
||||
{
|
||||
NodeArray.RemoveAt(nNodeIndex - 1);
|
||||
NodeArray[i].m_Arguments.RemoveAt(0);
|
||||
NodeArray.erase(NodeArray.begin() + nNodeIndex - 1);
|
||||
NodeArray[i].m_Arguments.erase(NodeArray[i].m_Arguments.begin() + 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -799,7 +797,7 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
NodeArray.InsertAt(i + 1, CNode(c_NodeBeginOfBlock));
|
||||
NodeArray.insert(NodeArray.begin() + i + 1, CNode(c_NodeBeginOfBlock));
|
||||
NodeArray[i + 1].m_ulOffset = NodeArray[i + 2].m_ulOffset;
|
||||
ulOffset = node.m_Opcode.GetArgument(); // offset for jump
|
||||
|
||||
@@ -811,7 +809,7 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
}
|
||||
while(node.m_ulOffset < ulOffset);
|
||||
|
||||
NodeArray.InsertAt(nNodeIndex, CNode(c_NodeEndOfBlock));
|
||||
NodeArray.insert(NodeArray.begin() + nNodeIndex, CNode(c_NodeEndOfBlock));
|
||||
NodeArray[nNodeIndex].m_ulOffset = NodeArray[nNodeIndex + 1].m_ulOffset;
|
||||
|
||||
node = NodeArray[nNodeIndex - 1];
|
||||
@@ -828,12 +826,12 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
//printf("(else) goto %x > %x", ulOffset, node.m_ulOffset);
|
||||
if (ulOffset > node.m_ulOffset)
|
||||
{
|
||||
NodeArray.RemoveAt(nNodeIndex - 1); // remove jump
|
||||
NodeArray.InsertAt(nNodeIndex, CNode(c_NodeBeginOfBlock));
|
||||
NodeArray.erase(NodeArray.begin() + nNodeIndex - 1); // remove jump
|
||||
NodeArray.insert(NodeArray.begin() + nNodeIndex, CNode(c_NodeBeginOfBlock));
|
||||
NodeArray[nNodeIndex].m_ulOffset = NodeArray[nNodeIndex + 1].m_ulOffset;
|
||||
|
||||
CNode Bnode = NodeArray[nNodeIndex - 1];
|
||||
CNode Cnode = NodeArray[nNodeIndex + 1];
|
||||
//CNode Cnode = NodeArray[nNodeIndex + 1];
|
||||
if ((Bnode.m_Type == CNode::TYPE_END_OF_BLOCK)/* &&
|
||||
(Cnode.m_Opcode.GetOperator() != COpcode::O_IF)*/)
|
||||
{
|
||||
@@ -842,13 +840,13 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
node = NodeArray[nNodeIndex = NextNodeIndex(NodeArray, nNodeIndex, 1)];
|
||||
}
|
||||
while(node.m_ulOffset < ulOffset);
|
||||
NodeArray.InsertAt(nNodeIndex, CNode(c_NodeEndOfBlock));
|
||||
NodeArray.insert(NodeArray.begin() + nNodeIndex, CNode(c_NodeEndOfBlock));
|
||||
NodeArray[nNodeIndex].m_ulOffset = NodeArray[nNodeIndex + 1].m_ulOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NodeArray[i].m_Arguments.RemoveAt(0);
|
||||
NodeArray[i].m_Arguments.erase(NodeArray[i].m_Arguments.begin() + 0);
|
||||
i++;
|
||||
|
||||
break;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
// C++ standard includes
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "FalloutScript.h"
|
||||
|
||||
// Third party includes
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
// C++ standard includes
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "FalloutScript.h"
|
||||
#include "Utility.h"
|
||||
|
||||
@@ -41,13 +40,13 @@ void CFalloutScript::Dump(CArchive& ar)
|
||||
|
||||
ar.WriteString("============== Global variables values ==================\n");
|
||||
|
||||
if (m_GlobalVar.IsEmpty())
|
||||
if (m_GlobalVar.empty())
|
||||
{
|
||||
ar.WriteString("Not found\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
for(unsigned int i = 0; i < m_GlobalVar.GetSize(); i++)
|
||||
for(unsigned int i = 0; i < m_GlobalVar.size(); i++)
|
||||
{
|
||||
wOperator = m_GlobalVar[i].GetOperator();
|
||||
ulArgument = m_GlobalVar[i].GetArgument();
|
||||
@@ -81,13 +80,13 @@ void CFalloutScript::Dump(CArchive& ar)
|
||||
|
||||
ar.WriteString("============== Exported variables ==================\n");
|
||||
|
||||
if (m_ExportedVarValue.IsEmpty())
|
||||
if (m_ExportedVarValue.empty())
|
||||
{
|
||||
ar.WriteString("Not found\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int32_t i = 0; i < m_ExportedVarValue.GetSize(); i += 2)
|
||||
for(int32_t i = 0; i < m_ExportedVarValue.size(); i += 2)
|
||||
{
|
||||
wOperator = m_ExportedVarValue[i].GetOperator();
|
||||
ulArgument = m_ExportedVarValue[i].GetArgument();
|
||||
@@ -133,7 +132,7 @@ void CFalloutScript::Dump(CArchive& ar)
|
||||
ar.WriteString(strOutLine);
|
||||
ar.WriteString("===============================\n");
|
||||
|
||||
for(int32_t i = 0; i < m_ProcBodies[nIndexOfProc].GetSize(); i++)
|
||||
for(int32_t i = 0; i < m_ProcBodies[nIndexOfProc].size(); i++)
|
||||
{
|
||||
wOperator = m_ProcBodies[nIndexOfProc][i].m_Opcode.GetOperator();
|
||||
ulArgument = m_ProcBodies[nIndexOfProc][i].m_Opcode.GetArgument();
|
||||
|
||||
+15
-16
@@ -11,7 +11,6 @@
|
||||
#include <iostream>
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "FalloutScript.h"
|
||||
#include "ObjectAttributes.h"
|
||||
#include "Utility.h"
|
||||
@@ -38,7 +37,7 @@ void CFalloutScript::StoreTree(CArchive& ar)
|
||||
ar.WriteString("Condition\n");
|
||||
ar.WriteString("===============================\n");
|
||||
|
||||
for(int32_t i = 0; i < m_Conditions[nIndexOfProc].GetSize(); i++)
|
||||
for(int32_t i = 0; i < m_Conditions[nIndexOfProc].size(); i++)
|
||||
{
|
||||
strOutLine = format("0x%08X: ", m_Conditions[nIndexOfProc][i].m_ulOffset);
|
||||
ar.WriteString(strOutLine);
|
||||
@@ -50,7 +49,7 @@ void CFalloutScript::StoreTree(CArchive& ar)
|
||||
ar.WriteString("===============================\n");
|
||||
}
|
||||
|
||||
for(int32_t i = 0; i < m_ProcBodies[nIndexOfProc].GetSize(); i++)
|
||||
for(int32_t i = 0; i < m_ProcBodies[nIndexOfProc].size(); i++)
|
||||
{
|
||||
strOutLine = format("0x%08X: ", m_ProcBodies[nIndexOfProc][i].m_ulOffset);
|
||||
ar.WriteString(strOutLine);
|
||||
@@ -92,7 +91,7 @@ void CFalloutScript::StoreDefinitions(CArchive& ar)
|
||||
ar.WriteString("*******************************************************/\n");
|
||||
ar.WriteString("\n");
|
||||
|
||||
for(int32_t i = 0; i < m_GlobalVar.GetSize(); i++)
|
||||
for(int32_t i = 0; i < m_GlobalVar.size(); i++)
|
||||
{
|
||||
ulVarValue = m_GlobalVar[i].GetArgument();
|
||||
strDefinition += "variable ";
|
||||
@@ -406,7 +405,7 @@ void CFalloutScript::StoreDeclarations(CArchive& ar)
|
||||
int32_t nIndentLevel = 0;
|
||||
CNode::Type prevNodeType = CNode::TYPE_NORMAL;
|
||||
|
||||
for(int32_t nNodeIndex = 0; nNodeIndex < m_ProcBodies[i].GetSize(); nNodeIndex++)
|
||||
for(int32_t nNodeIndex = 0; nNodeIndex < m_ProcBodies[i].size(); nNodeIndex++)
|
||||
{
|
||||
if (m_ProcBodies[i][nNodeIndex].m_Type == CNode::TYPE_BEGIN_OF_BLOCK)
|
||||
{
|
||||
@@ -466,7 +465,7 @@ void CFalloutScript::StoreDeclarations(CArchive& ar)
|
||||
if (m_ProcBodies[i][nNodeIndex].m_Type == CNode::TYPE_FOR_LOOP)
|
||||
{
|
||||
std::string str = GetIndentString(nIndentLevel) + "for (";
|
||||
for (int32_t j = 0; j < m_ProcBodies[i][nNodeIndex].m_Arguments.GetSize(); j++)
|
||||
for (int32_t j = 0; j < m_ProcBodies[i][nNodeIndex].m_Arguments.size(); j++)
|
||||
{
|
||||
if (j > 0)
|
||||
{
|
||||
@@ -701,18 +700,18 @@ std::string CFalloutScript::GetSource(CNode& node, bool bLabel, uint32_t ulNumAr
|
||||
break;
|
||||
|
||||
case COpcode::O_CALL:
|
||||
if (node.m_Arguments[node.m_Arguments.GetUpperBound()].m_Opcode.GetOperator() == COpcode::O_INTOP)
|
||||
if (node.m_Arguments[node.m_Arguments.size() - 1].m_Opcode.GetOperator() == COpcode::O_INTOP)
|
||||
{
|
||||
strResult = m_Namespace[m_ProcTable[node.m_Arguments[node.m_Arguments.GetUpperBound()].m_Opcode.GetArgument()].m_ulNameOffset];
|
||||
strResult = m_Namespace[m_ProcTable[node.m_Arguments[node.m_Arguments.size() - 1].m_Opcode.GetArgument()].m_ulNameOffset];
|
||||
}
|
||||
else
|
||||
{
|
||||
strResult = GetSource(node.m_Arguments[node.m_Arguments.GetUpperBound()], false, ulNumArgs);
|
||||
strResult = GetSource(node.m_Arguments[node.m_Arguments.size() - 1], false, ulNumArgs);
|
||||
}
|
||||
|
||||
strResult += "(";
|
||||
|
||||
for(int32_t nArgIndex = 0; nArgIndex < node.m_Arguments.GetUpperBound() - 1; nArgIndex++)
|
||||
for(int32_t nArgIndex = 0; nArgIndex < node.m_Arguments.size() - 1 - 1; nArgIndex++)
|
||||
{
|
||||
if (nArgIndex == 0)
|
||||
{
|
||||
@@ -765,7 +764,7 @@ std::string CFalloutScript::GetSource(CNode& node, bool bLabel, uint32_t ulNumAr
|
||||
strResult = "addRegion ";
|
||||
strResult += GetSource(node.m_Arguments[0], false, ulNumArgs) + " { ";
|
||||
|
||||
for(int32_t nArgIndex = 1; nArgIndex < node.m_Arguments.GetUpperBound(); nArgIndex++)
|
||||
for(int32_t nArgIndex = 1; nArgIndex < node.m_Arguments.size() - 1; nArgIndex++)
|
||||
{
|
||||
if (nArgIndex == 1)
|
||||
{
|
||||
@@ -913,14 +912,14 @@ std::string CFalloutScript::GetSource(CNode& node, bool bLabel, uint32_t ulNumAr
|
||||
}
|
||||
if (node.m_Type == CNode::TYPE_CONDITIONAL_EXPRESSION)
|
||||
{
|
||||
if (node.m_Arguments.GetSize() != 3)
|
||||
if (node.m_Arguments.size() != 3)
|
||||
{
|
||||
printf("Error: Invalid number of arguments in conditional expression\n");
|
||||
throw std::exception();
|
||||
}
|
||||
std::string sPostfix[] = { " if ", " else ", ""};
|
||||
strResult = "";
|
||||
for(int32_t i = 0; i < node.m_Arguments.GetSize(); i++)
|
||||
for(int32_t i = 0; i < node.m_Arguments.size(); i++)
|
||||
{
|
||||
bool bParens = ArgNeedParens(node, node.m_Arguments[i], CFalloutScript::RIGHT_ASSOC);
|
||||
strResult += (bParens ? "(" : "") + GetSource(node.m_Arguments[i], bLabel, ulNumArgs) + (bParens ? ")" : "") + sPostfix[i];
|
||||
@@ -959,7 +958,7 @@ std::string CFalloutScript::GetSource(CNode& node, bool bLabel, uint32_t ulNumAr
|
||||
case COpcode::COpcodeAttributes::CATEGORY_PREFIX:
|
||||
strResult = attributes.m_strName;
|
||||
|
||||
if (node.m_Arguments.GetSize() != 0)
|
||||
if (node.m_Arguments.size() != 0)
|
||||
{
|
||||
if (wOperator == COpcode::O_IF || wOperator == COpcode::O_WHILE)
|
||||
{
|
||||
@@ -968,7 +967,7 @@ std::string CFalloutScript::GetSource(CNode& node, bool bLabel, uint32_t ulNumAr
|
||||
|
||||
strResult += "(";
|
||||
|
||||
for(int32_t i = 0; i < node.m_Arguments.GetSize(); i++)
|
||||
for(int32_t i = 0; i < node.m_Arguments.size(); i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
@@ -998,7 +997,7 @@ std::string CFalloutScript::GetSource( CNode& node, bool bLabel, uint32_t ulNumA
|
||||
std::string strArgument;
|
||||
bool bIsProcArg;
|
||||
|
||||
for(int32_t nArgIndex = 0; nArgIndex < node.m_Arguments.GetSize(); nArgIndex++)
|
||||
for(int32_t nArgIndex = 0; nArgIndex < node.m_Arguments.size(); nArgIndex++)
|
||||
{
|
||||
bIsProcArg = false;
|
||||
|
||||
|
||||
+5
-6
@@ -10,7 +10,6 @@
|
||||
// C++ standard includes
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "Namespace.h"
|
||||
#include "Utility.h"
|
||||
|
||||
@@ -28,7 +27,7 @@ CNamespace::~CNamespace()
|
||||
void CNamespace::Serialize(CArchive& ar)
|
||||
{
|
||||
m_Map.RemoveAll();
|
||||
m_Order.RemoveAll();
|
||||
m_Order.clear();;
|
||||
|
||||
uint32_t ulLength;
|
||||
|
||||
@@ -91,7 +90,7 @@ void CNamespace::Serialize(CArchive& ar)
|
||||
}
|
||||
|
||||
m_Map.SetAt(ulTotalRead + 6, strNewString);
|
||||
m_Order.Add(ulTotalRead + 6);
|
||||
m_Order.push_back(ulTotalRead + 6);
|
||||
|
||||
ulTotalRead += (2 + wLengthOfString);
|
||||
}
|
||||
@@ -137,20 +136,20 @@ void CNamespace::Dump(CArchive& ar)
|
||||
{
|
||||
std::string strOutLine;
|
||||
|
||||
if (m_Order.IsEmpty())
|
||||
if (m_Order.empty())
|
||||
{
|
||||
ar.WriteString("Empty\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
for(unsigned int i = 0; i < m_Order.GetSize(); i++)
|
||||
for(unsigned int i = 0; i < m_Order.size(); i++)
|
||||
{
|
||||
strOutLine = format("0x%08X: \"%s\"\n", m_Order[i], GetStringByIndex(i).c_str());
|
||||
ar.WriteString(strOutLine);
|
||||
}
|
||||
|
||||
ar.WriteString("==================\n");
|
||||
strOutLine = format("%d item(s)\n", m_Order.GetSize());
|
||||
strOutLine = format("%d item(s)\n", m_Order.size());
|
||||
ar.WriteString(strOutLine);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@
|
||||
#define NAMESPACE_H
|
||||
|
||||
// C++ standard includes
|
||||
#include <vector>
|
||||
|
||||
// int2ssl includes
|
||||
#include "Hacks/CArchive.h"
|
||||
@@ -41,7 +42,7 @@ private:
|
||||
typedef CMap<uint32_t, uint32_t, std::string, const char*> CMapDWordToString;
|
||||
|
||||
CMapDWordToString m_Map;
|
||||
CDWordArray m_Order;
|
||||
std::vector<uint32_t> m_Order;
|
||||
};
|
||||
|
||||
#endif //NAMESPACE_H
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
// C++ standard includes
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "Node.h"
|
||||
#include "Utility.h"
|
||||
|
||||
@@ -28,7 +27,7 @@ CNode::CNode(const CNode& node) :
|
||||
m_Opcode(node.m_Opcode),
|
||||
m_Type(node.m_Type)
|
||||
{
|
||||
m_Arguments.Copy(node.m_Arguments);
|
||||
m_Arguments = node.m_Arguments;
|
||||
}
|
||||
|
||||
CNode::~CNode()
|
||||
@@ -42,7 +41,7 @@ CNode& CNode::operator = (const CNode& node)
|
||||
m_ulOffset = node.m_ulOffset;
|
||||
m_Opcode = node.m_Opcode;
|
||||
m_Type = node.m_Type;
|
||||
m_Arguments.Copy(node.m_Arguments);
|
||||
m_Arguments = node.m_Arguments;
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
@@ -98,9 +97,9 @@ void CNode::StoreTree(CArchive& ar, int nIndent, int nIndex)
|
||||
wOperator);
|
||||
ar.WriteString(strOutLine);
|
||||
}
|
||||
if (!m_Arguments.IsEmpty())
|
||||
if (!m_Arguments.empty())
|
||||
{
|
||||
for(int i = 0; i < m_Arguments.GetSize(); i++)
|
||||
for(int i = 0; i < m_Arguments.size(); i++)
|
||||
{
|
||||
m_Arguments[i].StoreTree(ar, nIndent + 1, i);
|
||||
}
|
||||
@@ -114,7 +113,7 @@ void CNode::StoreTree(CArchive& ar, int nIndent, int nIndex)
|
||||
|
||||
uint32_t CNode::GetTopOffset()
|
||||
{
|
||||
if (m_Arguments.GetSize() > 0)
|
||||
if (m_Arguments.size() > 0)
|
||||
{
|
||||
return m_Arguments[0].GetTopOffset();
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
// Third party includes
|
||||
|
||||
class CNode;
|
||||
typedef CArray<CNode, CNode&> CNodeArray;
|
||||
typedef CArray<CNodeArray, CNodeArray&> CArrayOfNodeArray;
|
||||
typedef std::vector<CNode> CNodeArray;
|
||||
typedef std::vector<CNodeArray> CArrayOfNodeArray;
|
||||
|
||||
class CNode
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <iostream>
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "Opcode.h"
|
||||
#include "Utility.h"
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define OPCODE_H
|
||||
|
||||
// C++ standard includes
|
||||
#include <vector>
|
||||
|
||||
// int2ssl includes
|
||||
#include "Hacks/CArchive.h"
|
||||
@@ -850,6 +851,6 @@ private:
|
||||
uint32_t m_ulArgument;
|
||||
};
|
||||
|
||||
typedef CArray<COpcode, COpcode&> COpcodeArray;
|
||||
typedef std::vector<COpcode> COpcodeArray;
|
||||
|
||||
#endif // OPCODE_H
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
// C++ standard includes
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "Opcode.h"
|
||||
|
||||
// Third party includes
|
||||
|
||||
+9
-9
@@ -9,9 +9,9 @@
|
||||
|
||||
// C++ standard includes
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "ProcTable.h"
|
||||
#include "Utility.h"
|
||||
#include "ObjectAttributes.h"
|
||||
@@ -187,8 +187,8 @@ int compareProcBodyOffsets(const void* elem0, const void* elem1)
|
||||
|
||||
void CProcTable::Serialize(CArchive& ar)
|
||||
{
|
||||
m_Table.RemoveAll();
|
||||
m_ProcSize.RemoveAll();
|
||||
m_Table.clear();
|
||||
m_ProcSize.clear();
|
||||
|
||||
uint32_t ulSizeOfTable;
|
||||
uint32_t ulRead;
|
||||
@@ -204,8 +204,8 @@ void CProcTable::Serialize(CArchive& ar)
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
m_Table.SetSize(ulSizeOfTable);
|
||||
m_ProcSize.SetSize(ulSizeOfTable);
|
||||
m_Table.resize(ulSizeOfTable);
|
||||
m_ProcSize.resize(ulSizeOfTable);
|
||||
|
||||
uint32_t ulIndexOfProcOffset = 0;
|
||||
ProcBodyOffset* pOffsets = new ProcBodyOffset[ulSizeOfTable + 1];
|
||||
@@ -279,12 +279,12 @@ void CProcTable::Serialize(CArchive& ar)
|
||||
|
||||
int32_t CProcTable::GetSize()
|
||||
{
|
||||
return m_Table.GetSize();
|
||||
return m_Table.size();
|
||||
}
|
||||
|
||||
uint32_t CProcTable::GetSizeOfProc(int32_t nIndex)
|
||||
{
|
||||
if ((nIndex < 0) || (nIndex > m_ProcSize.GetUpperBound()))
|
||||
if ((nIndex < 0) || (nIndex >= m_ProcSize.size()))
|
||||
{
|
||||
printf("Warning: Invalid index of procedure (%d). Exception will be thrown\n", nIndex);
|
||||
throw std::exception();
|
||||
@@ -303,7 +303,7 @@ void CProcTable::Dump(CArchive& ar)
|
||||
{
|
||||
std::string strOutLine;
|
||||
|
||||
for(unsigned int i = 0; i < m_Table.GetSize(); i++)
|
||||
for(unsigned int i = 0; i < m_Table.size(); i++)
|
||||
{
|
||||
strOutLine = format("======== Procedure %d ========\n", i);
|
||||
|
||||
@@ -316,7 +316,7 @@ void CProcTable::Dump(CArchive& ar)
|
||||
|
||||
CProcDescriptor& CProcTable::operator [] (int32_t nIndex)
|
||||
{
|
||||
if ((nIndex < 0) || (nIndex > m_ProcSize.GetUpperBound()))
|
||||
if ((nIndex < 0) || (nIndex >= m_ProcSize.size()))
|
||||
{
|
||||
printf("Warning: Invalid index of procedure (%d). Exception will be thrown\n", nIndex);
|
||||
throw std::exception();
|
||||
|
||||
+2
-2
@@ -61,10 +61,10 @@ public:
|
||||
|
||||
private:
|
||||
// CProcTableArray
|
||||
typedef CArray<CProcDescriptor, CProcDescriptor&> CProcTableArray;
|
||||
typedef std::vector<CProcDescriptor> CProcTableArray;
|
||||
|
||||
CProcTableArray m_Table;
|
||||
CDWordArray m_ProcSize;
|
||||
std::vector<uint32_t> m_ProcSize;
|
||||
uint32_t m_ulOffsetOfProcSection;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
// C++ standard includes
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "StartupCode.h"
|
||||
|
||||
// Third party includes
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
// C++ standard includes
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "Utility.h"
|
||||
|
||||
// Third party includes
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// if you are using precompiled headers then include this line:
|
||||
#include "stdafx.h"
|
||||
//#include "stdafx.h"
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <iostream>
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
#include "FalloutScript.h"
|
||||
#include "XGetopt.h"
|
||||
#include "Utility.h"
|
||||
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* Copyright (c) 2005-2009 Anchorite (TeamX), <anchorite2001@yandex.ru>
|
||||
* Copyright (c) 20014-2015 Nirran, phobos2077
|
||||
* Copyright (c) 20015 alexeevdv <mail@alexeevdv.ru>
|
||||
* Distributed under the GNU GPL v3. For full terms see the file license.txt
|
||||
*
|
||||
*/
|
||||
|
||||
// C++ standard includes
|
||||
|
||||
// int2ssl includes
|
||||
#include "stdafx.h"
|
||||
|
||||
// Third party includes
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user