From 17a4ee8a68c2d11660708e6de6338d7adb75f537 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Thu, 22 Dec 2022 20:18:07 +0300 Subject: [PATCH] Add Sfall version opcodes (#200) --- src/sfall_opcodes.cc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/sfall_opcodes.cc b/src/sfall_opcodes.cc index 14ba661..50e7d59 100644 --- a/src/sfall_opcodes.cc +++ b/src/sfall_opcodes.cc @@ -17,6 +17,10 @@ namespace fallout { +static constexpr int kVersionMajor = 4; +static constexpr int kVersionMinor = 3; +static constexpr int kVersionPatch = 4; + // read_byte static void opReadByte(Program* program) { @@ -119,6 +123,24 @@ static void opListEnd(Program* program) sfallListsDestroy(listId); } +// sfall_ver_major +static void opGetVersionMajor(Program* program) +{ + programStackPushInteger(program, kVersionMajor); +} + +// sfall_ver_minor +static void opGetVersionMinor(Program* program) +{ + programStackPushInteger(program, kVersionMinor); +} + +// sfall_ver_build +static void opGetVersionPatch(Program* program) +{ + programStackPushInteger(program, kVersionPatch); +} + // get_weapon_ammo_pid static void opGetWeaponAmmoPid(Program* program) { @@ -271,6 +293,9 @@ void sfallOpcodesInit() interpreterRegisterOpcode(0x820D, opListBegin); interpreterRegisterOpcode(0x820E, opListNext); interpreterRegisterOpcode(0x820F, opListEnd); + interpreterRegisterOpcode(0x8210, opGetVersionMajor); + interpreterRegisterOpcode(0x8211, opGetVersionMinor); + interpreterRegisterOpcode(0x8212, opGetVersionPatch); interpreterRegisterOpcode(0x8217, opGetWeaponAmmoPid); interpreterRegisterOpcode(0x8219, opGetWeaponAmmoCount); interpreterRegisterOpcode(0x821A, opSetWeaponAmmoCount);