mirror of
https://github.com/sfall-team/int2ssl.git
synced 2026-07-27 16:52:42 -07:00
CArchive and CFile are removed
This commit is contained in:
+49
-53
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
|
||||
// C++ standard includes
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
// int2ssl includes
|
||||
#include "FalloutScript.h"
|
||||
@@ -15,34 +17,37 @@
|
||||
|
||||
// Third party includes
|
||||
|
||||
void CFalloutScript::Dump(CArchive& ar)
|
||||
extern std::ifstream g_ifstream;
|
||||
extern std::ofstream g_ofstream;
|
||||
|
||||
void CFalloutScript::Dump()
|
||||
{
|
||||
ar.WriteString("============== Procedures table ==================\n");
|
||||
ar.WriteString("\n");
|
||||
m_ProcTable.Dump(ar);
|
||||
ar.WriteString("\n");
|
||||
ar.WriteString("\n");
|
||||
g_ofstream << "============== Procedures table ==================" << std::endl
|
||||
<< std::endl;
|
||||
m_ProcTable.Dump();
|
||||
g_ofstream << std::endl;
|
||||
g_ofstream << std::endl;
|
||||
|
||||
ar.WriteString("============== Namespace ==================\n");
|
||||
m_Namespace.Dump(ar);
|
||||
ar.WriteString("\n");
|
||||
ar.WriteString("\n");
|
||||
g_ofstream << "============== Namespace ==================" << std::endl;
|
||||
m_Namespace.Dump();
|
||||
g_ofstream << std::endl;
|
||||
g_ofstream << std::endl;
|
||||
|
||||
ar.WriteString("============== Stringspace ==================\n");
|
||||
m_Stringspace.Dump(ar);
|
||||
ar.WriteString("\n");
|
||||
ar.WriteString("\n");
|
||||
g_ofstream << "============== Stringspace ==================" << std::endl;
|
||||
m_Stringspace.Dump();
|
||||
g_ofstream << std::endl;
|
||||
g_ofstream << std::endl;
|
||||
|
||||
|
||||
std::string strOutLine;
|
||||
uint16_t wOperator;
|
||||
uint32_t ulArgument = 0;
|
||||
|
||||
ar.WriteString("============== Global variables values ==================\n");
|
||||
g_ofstream << "============== Global variables values ==================" << std::endl;
|
||||
|
||||
if (m_GlobalVar.empty())
|
||||
{
|
||||
ar.WriteString("Not found\n");
|
||||
g_ofstream << "Not found" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -55,34 +60,32 @@ void CFalloutScript::Dump(CArchive& ar)
|
||||
{
|
||||
case COpcode::O_STRINGOP:
|
||||
case COpcode::O_INTOP:
|
||||
strOutLine = format("%d: %s(0x%08x) // %u (%d)\n",
|
||||
g_ofstream << format("%d: %s(0x%08x) // %u (%d)",
|
||||
i,
|
||||
m_GlobalVar[i].GetAttributes().m_strMnemonic.c_str(),
|
||||
ulArgument,
|
||||
ulArgument,
|
||||
ulArgument);
|
||||
ar.WriteString(strOutLine);
|
||||
ulArgument) << std::endl;
|
||||
break;
|
||||
|
||||
case COpcode::O_FLOATOP:
|
||||
strOutLine = format("%d: %s(0x%08x) // %05f\n",
|
||||
g_ofstream << format("%d: %s(0x%08x) // %05f",
|
||||
i,
|
||||
m_GlobalVar[i].GetAttributes().m_strMnemonic.c_str(),
|
||||
ulArgument,
|
||||
*((float*)(&ulArgument)));
|
||||
ar.WriteString(strOutLine);
|
||||
*((float*)(&ulArgument))) << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ar.WriteString("\n");
|
||||
ar.WriteString("\n");
|
||||
g_ofstream << std::endl;
|
||||
g_ofstream << std::endl;
|
||||
|
||||
ar.WriteString("============== Exported variables ==================\n");
|
||||
g_ofstream << "============== Exported variables ==================" << std::endl;
|
||||
|
||||
if (m_ExportedVarValue.empty())
|
||||
{
|
||||
ar.WriteString("Not found\n");
|
||||
g_ofstream << "Not found" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -95,42 +98,38 @@ void CFalloutScript::Dump(CArchive& ar)
|
||||
switch(wOperator)
|
||||
{
|
||||
case COpcode::O_STRINGOP:
|
||||
strOutLine = format("%s := \"%s\"\n",
|
||||
g_ofstream << format("%s := \"%s\"",
|
||||
m_Namespace[ulNameArgument].c_str(),
|
||||
m_Stringspace[ulArgument].c_str());
|
||||
ar.WriteString(strOutLine);
|
||||
m_Stringspace[ulArgument].c_str()) << std::endl;
|
||||
break;
|
||||
|
||||
case COpcode::O_INTOP:
|
||||
strOutLine = format("%s := %u (%d)\n",
|
||||
g_ofstream << format("%s := %u (%d)",
|
||||
m_Namespace[ulNameArgument].c_str(),
|
||||
ulArgument,
|
||||
ulArgument);
|
||||
ar.WriteString(strOutLine);
|
||||
ulArgument) << std::endl;
|
||||
break;
|
||||
|
||||
case COpcode::O_FLOATOP:
|
||||
strOutLine = format("%s := %05f\n",
|
||||
g_ofstream << format("%s := %05f",
|
||||
m_Namespace[ulNameArgument].c_str(),
|
||||
*((float*)(&ulArgument)));
|
||||
ar.WriteString(strOutLine);
|
||||
*((float*)(&ulArgument))) << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ar.WriteString("\n");
|
||||
ar.WriteString("\n");
|
||||
g_ofstream << std::endl;
|
||||
g_ofstream << std::endl;
|
||||
|
||||
ar.WriteString("============== Procedures ==================\n");
|
||||
ar.WriteString("\n");
|
||||
g_ofstream << "============== Procedures ==================" << std::endl;
|
||||
g_ofstream << std::endl;
|
||||
|
||||
for(uint32_t nIndexOfProc = 0; nIndexOfProc < m_ProcTable.GetSize(); nIndexOfProc++)
|
||||
{
|
||||
strOutLine = format("%d: %s (0x%08x)\n", nIndexOfProc,
|
||||
g_ofstream << format("%d: %s (0x%08x)", nIndexOfProc,
|
||||
m_Namespace[m_ProcTable[nIndexOfProc].m_ulNameOffset].c_str(),
|
||||
m_ProcTable[nIndexOfProc].m_ulBodyOffset);
|
||||
ar.WriteString(strOutLine);
|
||||
ar.WriteString("===============================\n");
|
||||
m_ProcTable[nIndexOfProc].m_ulBodyOffset) << std::endl;
|
||||
g_ofstream << "===============================" << std::endl;
|
||||
|
||||
for(uint32_t i = 0; i < m_ProcBodies[nIndexOfProc].size(); i++)
|
||||
{
|
||||
@@ -141,36 +140,33 @@ void CFalloutScript::Dump(CArchive& ar)
|
||||
{
|
||||
case COpcode::O_STRINGOP:
|
||||
case COpcode::O_INTOP:
|
||||
strOutLine = format("0x%08X: 0x%04X 0x%08x - %s(0x%08x) // %u (%d)\n",
|
||||
g_ofstream << format("0x%08X: 0x%04X 0x%08x - %s(0x%08x) // %u (%d)",
|
||||
m_ProcBodies[nIndexOfProc][i].m_ulOffset,
|
||||
wOperator,
|
||||
ulArgument,
|
||||
m_ProcBodies[nIndexOfProc][i].m_Opcode.GetAttributes().m_strMnemonic.c_str(),
|
||||
ulArgument,
|
||||
ulArgument,
|
||||
ulArgument);
|
||||
ar.WriteString(strOutLine);
|
||||
ulArgument) << std::endl;
|
||||
break;
|
||||
|
||||
case COpcode::O_FLOATOP:
|
||||
strOutLine = format("0x%08X: 0x%04X 0x%08X - %s // %05f\n",
|
||||
g_ofstream << format("0x%08X: 0x%04X 0x%08X - %s // %05f",
|
||||
m_ProcBodies[nIndexOfProc][i].m_ulOffset,
|
||||
wOperator,
|
||||
ulArgument,
|
||||
m_ProcBodies[nIndexOfProc][i].m_Opcode.GetAttributes().m_strMnemonic.c_str(),
|
||||
*((float*)(&ulArgument)));
|
||||
ar.WriteString(strOutLine);
|
||||
*((float*)(&ulArgument))) << std::endl;
|
||||
break;
|
||||
|
||||
default:
|
||||
strOutLine = format("0x%08X: 0x%04X - %s\n",
|
||||
g_ofstream << format("0x%08X: 0x%04X - %s",
|
||||
m_ProcBodies[nIndexOfProc][i].m_ulOffset,
|
||||
wOperator,
|
||||
m_ProcBodies[nIndexOfProc][i].m_Opcode.GetAttributes().m_strMnemonic.c_str());
|
||||
ar.WriteString(strOutLine);
|
||||
m_ProcBodies[nIndexOfProc][i].m_Opcode.GetAttributes().m_strMnemonic.c_str()) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
ar.WriteString("\n");
|
||||
g_ofstream << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user