mirror of
https://github.com/sfall-team/int2ssl.git
synced 2026-07-27 16:52:42 -07:00
Added new logical operators 'AndAlso', 'OrElse' for short-circuit evaluation
Updated version and added changelog.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
int2ssl
|
||||
=====
|
||||
#### 8.4.5
|
||||
- Added new logical operators `AndAlso`, `OrElse`
|
||||
|
||||
#### 8.4.4
|
||||
- Added support for new opcodes `register_hook_proc_spec`, `reg_anim_callback`
|
||||
|
||||
#### 8.4.3 (2018-01-03)
|
||||
- AppVeyor configuration (alexeevdv)
|
||||
- Enabled code for `ceil` math function
|
||||
- Fixed missing argument for `how_much` function
|
||||
|
||||
#### 8.4.2 (2018-01-03)
|
||||
- Fixed some errors when parsing exported variable and procedure sections (phobos2077)
|
||||
- Replace linebreaks with escape sequence when storing string constants (phobos2077)
|
||||
- Added support for new universal sfall opcodes (phobos2077)
|
||||
|
||||
#### 8.3.1 (2018-01-03)
|
||||
- Files for debian packaging (alexeevdv)
|
||||
- TravisCI configuration (alexeevdv)
|
||||
|
||||
#### 8.3.0
|
||||
+10
-10
@@ -34,7 +34,7 @@ void CFalloutScript::InitDefinitions()
|
||||
for(int32_t i = 0; i < m_Namespace.GetSize(); i++)
|
||||
{
|
||||
ulNameOffset = m_Namespace.GetOffsetByIndex(i);
|
||||
|
||||
|
||||
if ((nObjectIndex = GetIndexOfProc(ulNameOffset)) != -1)
|
||||
{
|
||||
m_Definitions.SetAt(ulNameOffset, CDefObject(CDefObject::OBJECT_PROCEDURE, 0, uint32_t(nObjectIndex)));
|
||||
@@ -62,7 +62,7 @@ void CFalloutScript::ProcessCode()
|
||||
InitialReduce();
|
||||
|
||||
printf(" Building execution tree\n");
|
||||
|
||||
|
||||
for(uint32_t i = 0; i < m_ProcTable.GetSize(); i++)
|
||||
{
|
||||
printf(" Procedure: %d\n", i);
|
||||
@@ -70,7 +70,7 @@ void CFalloutScript::ProcessCode()
|
||||
}
|
||||
|
||||
printf(" Extracting and reducing conditions\n");
|
||||
|
||||
|
||||
for(uint32_t i = 0; i < m_ProcTable.GetSize(); i++)
|
||||
{
|
||||
if (m_ProcTable[i].m_ulType & P_CONDITIONAL)
|
||||
@@ -96,7 +96,7 @@ void CFalloutScript::ProcessCode()
|
||||
do
|
||||
{
|
||||
node = m_ProcBodies[i][j = NextNodeIndex(m_ProcBodies[i], j, -1)];
|
||||
}
|
||||
}
|
||||
while(node.m_ulOffset != ulCondStartAddress);
|
||||
|
||||
j = NextNodeIndex(m_ProcBodies[i], j, -1); // For O_JMP opcode
|
||||
@@ -362,9 +362,9 @@ void CFalloutScript::InitialReduce()
|
||||
{
|
||||
// short circuit AND
|
||||
uint16_t actualOperator = CheckSequenceOfNodes(m_ProcBodies[i], j, awShortCircuitAnd, 5)
|
||||
? COpcode::O_AND
|
||||
? COpcode::O_AND_ALSO
|
||||
: (CheckSequenceOfNodes(m_ProcBodies[i], j, awShortCircuitOr, 6)
|
||||
? COpcode::O_OR
|
||||
? COpcode::O_OR_ELSE
|
||||
: 0);
|
||||
if (actualOperator)
|
||||
{
|
||||
@@ -378,9 +378,9 @@ void CFalloutScript::InitialReduce()
|
||||
while (skipOffset > m_ProcBodies[i][k].m_ulOffset);
|
||||
|
||||
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_Opcode.SetOperator(actualOperator); // place ANDALSO/ORELSE 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].erase(m_ProcBodies[i].begin() + j, m_ProcBodies[i].begin() + 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_ALSO ? 5 : 6)); // reduce
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -689,7 +689,7 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
NodeArray.insert(NodeArray.begin() + nLastNodeIndex + 1, CNode(c_NodeEndOfBlock));
|
||||
NodeArray[nLastNodeIndex].m_ulOffset = ulOffset;
|
||||
}
|
||||
|
||||
|
||||
// Body
|
||||
//CNode node;
|
||||
|
||||
@@ -801,7 +801,7 @@ void CFalloutScript::SetBordersOfBlocks(CNodeArray& NodeArray)
|
||||
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
|
||||
|
||||
|
||||
int32_t nNodeIndex = i + 1;
|
||||
|
||||
do
|
||||
|
||||
@@ -730,7 +730,7 @@ public:
|
||||
|
||||
O_TS_EXPLOSIONS_METARULE,
|
||||
O_TS_REGISTER_HOOK_PROC,
|
||||
|
||||
|
||||
O_TS_POW,
|
||||
O_TS_LOG,
|
||||
O_TS_EXP,
|
||||
@@ -769,6 +769,11 @@ public:
|
||||
O_END_OP
|
||||
};
|
||||
|
||||
enum O_COND {
|
||||
O_AND_ALSO = O_END_OP,
|
||||
O_OR_ELSE
|
||||
};
|
||||
|
||||
enum O_DataType {
|
||||
O_STRINGOP = (O_CONST | O_STRING), // 0x9001
|
||||
O_FLOATOP = (O_CONST | O_FLOAT), // 0xA001
|
||||
|
||||
+11
-10
@@ -11,6 +11,7 @@
|
||||
|
||||
// int2ssl includes
|
||||
#include "Opcode.h"
|
||||
#include "main.h"
|
||||
|
||||
// Third party includes
|
||||
|
||||
@@ -64,7 +65,7 @@ COpcode::CF1OpcodeAttributesMap::CF1OpcodeAttributesMap()
|
||||
//COpcode::COpcodeAttributes::Category infix = COpcode::COpcodeAttributes::CATEGORY_INFIX;
|
||||
|
||||
InitHashTable(32);
|
||||
|
||||
|
||||
SetAt(O_REACTION, COpcodeAttributes("O_REACTION", "reaction", 3, expression));
|
||||
SetAt(O_ANIMATE_JUMP, COpcodeAttributes("O_ANIMATE_JUMP", "animate_jump", 0));
|
||||
SetAt(O_TURN_OFF_OBJS_IN_AREA, COpcodeAttributes("O_TURN_OFF_OBJS_IN_AREA", "turn_off_objs_in_area", 4));
|
||||
@@ -427,7 +428,10 @@ COpcode::CF2OpcodeAttributesMap::CF2OpcodeAttributesMap()
|
||||
SetAt(O_DEBUG_MSG, COpcodeAttributes("O_DEBUG_MSG", "debug_msg", 1));
|
||||
SetAt(O_CRITTER_STOP_ATTACKING, COpcodeAttributes("O_CRITTER_STOP_ATTACKING", "critter_stop_attacking", 1));
|
||||
|
||||
//sall start
|
||||
SetAt(O_AND_ALSO, COpcodeAttributes("O_AND_ALSO", (useOldShortCircuit) ? "and" : "andAlso", 2, expression, infix));
|
||||
SetAt(O_OR_ELSE, COpcodeAttributes("O_OR_ELSE", (useOldShortCircuit) ? "or" : "orElse", 2, expression, infix));
|
||||
|
||||
//sfall start
|
||||
|
||||
SetAt(O_READ_BYTE, COpcodeAttributes("O_READ_BYTE", "read_byte", 1, expression));
|
||||
SetAt(O_READ_SHORT, COpcodeAttributes("O_READ_SHORT", "read_short", 1, expression));
|
||||
@@ -604,8 +608,6 @@ COpcode::CF2OpcodeAttributesMap::CF2OpcodeAttributesMap()
|
||||
SetAt(O_GET_BODYPART_HIT_MODIFIER, COpcodeAttributes("O_GET_BODYPART_HIT_MODIFIER", "get_bodypart_hit_modifier", 1, expression));
|
||||
SetAt(O_SET_BODYPART_HIT_MODIFIER, COpcodeAttributes("O_SET_BODYPART_HIT_MODIFIER", "set_bodypart_hit_modifier", 2));
|
||||
|
||||
|
||||
|
||||
//1.41
|
||||
SetAt(O_SET_CRITICAL_TABLE, COpcodeAttributes("O_SET_CRITICAL_TABLE", "set_critical_table", 5));
|
||||
SetAt(O_GET_CRITICAL_TABLE, COpcodeAttributes("O_GET_CRITICAL_TABLE", "get_critical_table", 4, expression));
|
||||
@@ -676,7 +678,6 @@ COpcode::CF2OpcodeAttributesMap::CF2OpcodeAttributesMap()
|
||||
SetAt(O_SET_CRITTER_BURST_DISABLE, COpcodeAttributes("O_SET_CRITTER_BURST_DISABLE", "set_critter_burst_disable", 2));
|
||||
|
||||
|
||||
|
||||
SetAt(O_GET_WEAPON_AMMO_PID, COpcodeAttributes("O_GET_WEAPON_AMMO_PID", "get_weapon_ammo_pid", 1, expression));
|
||||
SetAt(O_SET_WEAPON_AMMO_PID, COpcodeAttributes("O_SET_WEAPON_AMMO_PID", "set_weapon_ammo_pid", 2));
|
||||
SetAt(O_GET_WEAPON_AMMO_COUNT, COpcodeAttributes("O_GET_WEAPON_AMMO_COUNT", "get_weapon_ammo_count", 1, expression));
|
||||
@@ -716,7 +717,7 @@ COpcode::CF2OpcodeAttributesMap::CF2OpcodeAttributesMap()
|
||||
SetAt(O_TS_ATOI, COpcodeAttributes("O_TS_ATOI", "atoi", 1, expression));
|
||||
SetAt(O_TS_ATOF, COpcodeAttributes("O_TS_ATOF", "atof", 1, expression));
|
||||
|
||||
// sfall 2.9a
|
||||
// sfall 2.9a
|
||||
SetAt(O_TS_SCAN_ARRAY, COpcodeAttributes("O_TS_SCAN_ARRAY", "scan_array", 2, expression));
|
||||
SetAt(O_TS_TILE_PID, COpcodeAttributes("O_TS_TILE_PID", "get_tile_fid", 1, expression));
|
||||
SetAt(O_TS_MODIFIED_INI, COpcodeAttributes("O_TS_MODIFIED_INI", "modified_ini", 0, expression));
|
||||
@@ -725,15 +726,15 @@ COpcode::CF2OpcodeAttributesMap::CF2OpcodeAttributesMap()
|
||||
// sfall 2.12
|
||||
SetAt(O_TS_SET_SFALL_ARG, COpcodeAttributes("O_TS_GET_SFALL_ARG", "set_sfall_arg", 2));
|
||||
|
||||
// sfall 2.16
|
||||
// sfall 2.16
|
||||
SetAt(O_TS_FORCE_AIMED_SHOTS, COpcodeAttributes("O_TS_FORCE_AIMED_SHOTS", "force_aimed_shots", 1));
|
||||
SetAt(O_TS_DISABLE_AIMED_SHOTS, COpcodeAttributes("O_TS_DISABLE_AIMED_SHOTS", "disable_aimed_shots", 1));
|
||||
SetAt(O_TS_MARK_MOVIE_PLAYED, COpcodeAttributes("O_TS_MARK_MOVIE_PLAYED", "mark_movie_played", 1));
|
||||
|
||||
// sfall 2.17
|
||||
// sfall 2.17
|
||||
SetAt(O_TS_GET_NPC_LEVEL, COpcodeAttributes("O_TS_GET_NPC_LEVEL", "get_npc_level", 1, expression));
|
||||
|
||||
// sfall 3.0
|
||||
// sfall 3.0
|
||||
SetAt(O_TS_SET_CRITTER_SKILL_POINTS, COpcodeAttributes("O_TS_SET_CRITTER_SKILL_POINTS", "set_critter_skill_points", 3));
|
||||
SetAt(O_TS_GET_CRITTER_SKILL_POINTS, COpcodeAttributes("O_TS_GET_CRITTER_SKILL_POINTS", "get_critter_skill_points", 2, expression));
|
||||
SetAt(O_TS_SET_AVAILABLE_SKILL_POINTS, COpcodeAttributes("O_TS_SET_AVAILABLE_SKILL_POINTS", "set_available_skill_points", 1));
|
||||
@@ -744,7 +745,7 @@ COpcode::CF2OpcodeAttributesMap::CF2OpcodeAttributesMap()
|
||||
SetAt(O_TS_GET_LAST_ATTACKER, COpcodeAttributes("O_TS_GET_LAST_ATTACKER", "get_last_target", 1, expression));
|
||||
SetAt(O_TS_BLOCK_COMBAT, COpcodeAttributes("O_TS_BLOCK_COMBAT", "block_combat", 1));
|
||||
|
||||
// sfall 3.3
|
||||
// sfall 3.3
|
||||
SetAt(O_TS_TILE_UNDER_CURSOR, COpcodeAttributes("O_TS_TILE_UNDER_CURSOR", "tile_under_cursor", 0, expression));
|
||||
SetAt(O_TS_GET_BARTER_MOD, COpcodeAttributes("O_TS_GET_BARTER_MOD", "gdialog_get_barter_mod", 0, expression));
|
||||
SetAt(O_TS_SET_INVEN_AP_COST, COpcodeAttributes("O_TS_SET_INVEN_AP_COST", "set_inven_ap_cost", 1));
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# int2ssl
|
||||
int2ssl
|
||||
=====
|
||||
|
||||
Script decompiler for Fallout 1/2.
|
||||
|
||||
Originally implemented by **Anchorite** (2005-2009).
|
||||
|
||||
Expanded for full *sfall* support by *Nirran* and *phobos2077* (2014-2015).
|
||||
Expanded for full *sfall* support by *Nirran*, *phobos2077*, *Mr.Stalin* (2014-2020).
|
||||
|
||||
Rewritten for multiple platform support by *alexeevdv* (2015).
|
||||
|
||||
@@ -172,6 +172,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="FalloutScript.h" />
|
||||
<ClInclude Include="Hacks\CMap.h" />
|
||||
<ClInclude Include="main.h" />
|
||||
<ClInclude Include="Namespace.h" />
|
||||
<ClInclude Include="Node.h" />
|
||||
<ClInclude Include="ObjectAttributes.h" />
|
||||
|
||||
@@ -88,6 +88,9 @@
|
||||
<ClInclude Include="XGetopt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="main.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="win2kcompat.asm" />
|
||||
|
||||
@@ -33,6 +33,7 @@ std::ofstream g_ofstream;
|
||||
std::string g_inputFileName;
|
||||
std::string g_outputFileName;
|
||||
|
||||
bool useOldShortCircuit = false;
|
||||
|
||||
// Functions
|
||||
void PrintUsage(std::string filename);
|
||||
@@ -40,10 +41,10 @@ bool ProcessCommandLine(int argc, char* argv[]);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::cout << "Fallout script decompiler, version 8.4.4 (sfall edition)" << std::endl
|
||||
std::cout << "Fallout script decompiler, version 8.4.5 (sfall edition)" << std::endl
|
||||
<< "Copyright (C) Anchorite (TeamX), 2005-2009" << std::endl
|
||||
<< "anchorite2001@yandex.ru" << std::endl
|
||||
<< "Continued by Nirran, phobos2077 (2014-2019)" << std::endl
|
||||
<< "Continued by Nirran, phobos2077, Mr.Stalin (2014-2020)" << std::endl
|
||||
<< "Crossplatformed by alexeevdv (2015)" << std::endl;
|
||||
|
||||
if (argc < 2 || !ProcessCommandLine(argc, argv))
|
||||
@@ -152,6 +153,7 @@ void PrintUsage(std::string filename)
|
||||
<< " -b: insert omitted arguments backward" << std::endl
|
||||
<< " -s: use Space instead of tab to indent" << std::endl
|
||||
<< " -e: stop decompiling on error" << std::endl
|
||||
<< " -c: use AND/OR operators for short-circuit evaluation" << std::endl
|
||||
<< " --: end of options" << std::endl;
|
||||
}
|
||||
|
||||
@@ -205,6 +207,9 @@ bool ProcessCommandLine(int argc, char* argv[])
|
||||
g_strIndentFill += " ";
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
useOldShortCircuit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user