diff --git a/.editorconfig b/.editorconfig index 5c5dce44..06574b47 100644 --- a/.editorconfig +++ b/.editorconfig @@ -71,5 +71,5 @@ end_of_line = lf [addons/main/LICENSE] end_of_line = lf -[.github/workflows/main.yml] +[.github/workflows/*.yml] end_of_line = lf \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 936f3b72..0e7c0e26 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,4 +9,6 @@ *.md text eol=crlf *.toml text eol=crlf *.txt text eol=crlf -*.xml text eol=crlf \ No newline at end of file +*.xml text eol=crlf +*.rhai text eol=crlf +*.inc text eol=crlf \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4836f1c..90486905 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,13 +19,13 @@ jobs: - name: Check for BOM uses: arma-actions/bom-check@master - name: .editorconfig Checker - uses: jokoho48/action-editorconfig-checker@main + uses: editorconfig-checker/action-editorconfig-checker@v2 - name: Setup Node.js environment - uses: actions/setup-node@v2.1.2 + uses: actions/setup-node@v4 - name: Run Stringtable Checker - run: cd tools/stringtableChecker && npm i &> /dev/null && cd ../../ && node tools/stringtableChecker/stringTableChecker.js + run: cd tools/nodejs_tools && npm i &> /dev/null && cd ../../ && node tools/nodejs_tools/stringTableChecker.js - name: Check Functions - run: node tools/prepchecker.js + run: node tools/nodejs_tools/prepchecker.js lint: runs-on: ubuntu-latest @@ -35,7 +35,7 @@ jobs: - name: Lint (sqflint) uses: jokoho48/sqflint@master continue-on-error: true # No failure due to many false-positives - - uses: actions/upload-artifact@master + - uses: actions/upload-artifact@v4 with: name: 'sqfLint Log' path: 'sqf.log' @@ -48,14 +48,19 @@ jobs: - uses: actions/checkout@master with: fetch-depth: 1 - - name: Build addon with HEMTT - uses: arma-actions/hemtt@master - with: - command: 'build --release' - - uses: actions/upload-artifact@master + - name: Setup Node.js environment + uses: actions/setup-node@v4 + - name: Setup HEMTT + uses: arma-actions/hemtt@v1 + - name: Run HEMTT build + run: hemtt release + - name: Check Hemtt Annotactions + run: cd tools/nodejs_tools && npm i &> /dev/null && cd ../../ && node tools/nodejs_tools/hemttchecker.js + - name: Upload Release + uses: actions/upload-artifact@v4 with: name: '@LambsDanger' - path: 'releases/@LambsDanger*.zip' + path: '.hemttout/release/*' stringtables: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..78fc0fc9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: Release + +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Setup HEMTT + uses: arma-actions/hemtt@main + - name: Run HEMTT build + run: hemtt release + - run: | + version="${{ github.event.release.tag_name }}" + mv releases/lambs-latest.zip "@LambsDanger_${version//[.]/_}.zip" + - name: Update Release with Files + id: create_version_release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true # Set this to false if you want to prevent updating existing releases + name: ${{ github.event.release.name }} + draft: ${{ github.event.release.unpublished }} + prerelease: ${{ github.event.release.prerelease }} + token: ${{ secrets.GITHUB_TOKEN }} + artifacts: "./@LambsDanger_*.zip" + tag: ${{ github.event.release.tag_name }} + body: ${{ github.event.release.body }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 56045e59..7a627ece 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,10 @@ lint.bat sqf/* -tools/stringtableChecker/node_modules +tools/nodejs_tools/node_modules .vscode/ *.sqfc + +.hemttout/ \ No newline at end of file diff --git a/.hemtt/hooks/pre_release/set_version.rhai b/.hemtt/hooks/pre_release/set_version.rhai new file mode 100644 index 00000000..40325637 --- /dev/null +++ b/.hemtt/hooks/pre_release/set_version.rhai @@ -0,0 +1,14 @@ +// Read the current contents of the mod.cpp +// file from the project source +let version = HEMTT_DIRECTORY + .join("mod.cpp") + .open_file() + .read(); +// Replace the placeholder version with the actual version +version.replace("{version}", HEMTT.project().version().to_string_short()); +// Write the new contents to the build output +// create_file will overwrite the file if it exists +HEMTT_OUTPUT + .join("mod.cpp") + .create_file() + .write(version); \ No newline at end of file diff --git a/.hemtt/project.toml b/.hemtt/project.toml new file mode 100644 index 00000000..4b3a8d33 --- /dev/null +++ b/.hemtt/project.toml @@ -0,0 +1,37 @@ +name = "LAMBS Danger" +prefix = "lambs" +author = "LAMBS Dev Team" +mainprefix = "z" + +[version] +path = "addons/main/script_version.hpp" +git_hash = 0 + +[files] +include = [ + "mod.cpp", + "*.paa", + "LICENSE", + "readme.txt", + "readme.md" +] + +[hemtt.signing] +authority = "LambsDanger" + +[hemtt.release] +folder = "lambs_danger" + +[hemtt.launch.default] +workshop = [ + "450814997", # CBA_A3's Workshop ID +] + +parameters = [ + "-skipIntro", # These parameters are passed to the Arma 3 executable + "-noSplash", # They do not need to be added to your list + "-showScriptErrors", # You can add additional parameters here + "-debug", + "-world=empty", + "-filePatching", +] \ No newline at end of file diff --git a/addons/danger/XEH_preInit.sqf b/addons/danger/XEH_preInit.sqf index 63c6251c..ec809bcc 100644 --- a/addons/danger/XEH_preInit.sqf +++ b/addons/danger/XEH_preInit.sqf @@ -5,7 +5,7 @@ ADDON = false; // mod check GVAR(Loaded_WP) = isClass (configfile >> "CfgPatches" >> "lambs_wp"); -#include "settings.sqf" +#include "settings.inc.sqf" // FSM priorities ~ this could be made into CBA settings. But I kinda want to explore it a little first - nkenny if (isNil QGVAR(fsmPriorities)) then { diff --git a/addons/danger/settings.sqf b/addons/danger/settings.inc.sqf similarity index 100% rename from addons/danger/settings.sqf rename to addons/danger/settings.inc.sqf diff --git a/addons/eventhandlers/XEH_preInit.sqf b/addons/eventhandlers/XEH_preInit.sqf index 54339843..dd9a2bf1 100644 --- a/addons/eventhandlers/XEH_preInit.sqf +++ b/addons/eventhandlers/XEH_preInit.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" ADDON = false; -#include "settings.sqf" +#include "settings.inc.sqf" #include "XEH_PREP.hpp" diff --git a/addons/eventhandlers/settings.sqf b/addons/eventhandlers/settings.inc.sqf similarity index 100% rename from addons/eventhandlers/settings.sqf rename to addons/eventhandlers/settings.inc.sqf diff --git a/addons/formations/CfgFSMs.hpp b/addons/formations/CfgFSMs.hpp index ed69f748..42231b93 100644 --- a/addons/formations/CfgFSMs.hpp +++ b/addons/formations/CfgFSMs.hpp @@ -29,8 +29,8 @@ class CfgFSMs { function = "nothing"; parameters[] = {}; thresholds[] = {}; - } - } + }; + }; }; }; }; diff --git a/addons/main/XEH_preInit.sqf b/addons/main/XEH_preInit.sqf index 38a20f48..205587a1 100644 --- a/addons/main/XEH_preInit.sqf +++ b/addons/main/XEH_preInit.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" ADDON = false; #include "XEH_PREP.hpp" -#include "settings.sqf" +#include "settings.inc.sqf" GVAR(ChooseDialogSettingsCache) = false call CBA_fnc_createNamespace; // check for WP module diff --git a/addons/main/functions/fnc_showDialog.sqf b/addons/main/functions/fnc_showDialog.sqf index a8af3956..b2dd2e95 100644 --- a/addons/main/functions/fnc_showDialog.sqf +++ b/addons/main/functions/fnc_showDialog.sqf @@ -1,5 +1,5 @@ #include "script_component.hpp" -#include "\a3\ui_f\hpp\definedikcodes.inc" +#include "\a3\ui_f\hpp\defineDIKCodes.inc" /* * Author: joko // Jonas * Parses Data from UI Elements from Show Dialog diff --git a/addons/main/script_version.hpp b/addons/main/script_version.hpp index e15faaba..b808ff46 100644 --- a/addons/main/script_version.hpp +++ b/addons/main/script_version.hpp @@ -1,4 +1,4 @@ -#define MAJOR 0 -#define MINOR 0 -#define PATCHLVL 0 +#define MAJOR 1 +#define MINOR 6 +#define PATCHLVL 1 #define BUILD 0 diff --git a/addons/main/settings.sqf b/addons/main/settings.inc.sqf similarity index 100% rename from addons/main/settings.sqf rename to addons/main/settings.inc.sqf diff --git a/addons/wp/XEH_preInit.sqf b/addons/wp/XEH_preInit.sqf index 4b100e8f..7ced66ec 100644 --- a/addons/wp/XEH_preInit.sqf +++ b/addons/wp/XEH_preInit.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" ADDON = false; -#include "settings.sqf" +#include "settings.inc.sqf" #include "XEH_PREP.hpp" if (isServer) then { diff --git a/addons/wp/ZEN_CfgContext.hpp b/addons/wp/ZEN_CfgContext.hpp index 976b84a4..80617c14 100644 --- a/addons/wp/ZEN_CfgContext.hpp +++ b/addons/wp/ZEN_CfgContext.hpp @@ -5,38 +5,38 @@ class ZEN_context_menu_actions { priority = 3; class CreateTarget { displayName = CSTRING(Context_CreateTarget); - statement = QUOTE([ARR_2(_objects, _position)] call FUNC(setTarget)); + statement = QUOTE([ARR_2(_objects,_position)] call FUNC(setTarget)); icon = "\a3\3den\Data\CfgWaypoints\destroy_ca.paa"; }; class TaskArtilleryRegister { displayName = CSTRING(Module_TaskArtilleryRegister_DisplayName); - statement = QUOTE([ARR_2(_groups, _objects)] call FUNC(setArtilleryRegister)); + statement = QUOTE([ARR_2(_groups,_objects)] call FUNC(setArtilleryRegister)); icon = "\A3\ui_f\data\igui\cfg\simpleTasks\types\intel_ca.paa"; }; class TaskCamp { displayName = CSTRING(Module_TaskCamp_DisplayName); - statement = QUOTE([ARR_2(_groups, _objects)] call FUNC(setCamp)); + statement = QUOTE([ARR_2(_groups,_objects)] call FUNC(setCamp)); icon = "\a3\3DEN\Data\CfgWaypoints\Guard_ca.paa"; }; class TaskCQB { displayName = CSTRING(Module_TaskCQB_DisplayName); - statement = QUOTE([ARR_2(_groups, _objects)] call FUNC(setCQB)); + statement = QUOTE([ARR_2(_groups,_objects)] call FUNC(setCQB)); icon = "\a3\3DEN\Data\CfgWaypoints\Scripted_ca.paa"; }; class TaskGarrison { displayName = CSTRING(Module_TaskGarrison_DisplayName); - statement = QUOTE([ARR_2(_groups, _objects)] call FUNC(setGarrison)); + statement = QUOTE([ARR_2(_groups,_objects)] call FUNC(setGarrison)); icon = "\a3\3DEN\Data\CfgWaypoints\Guard_ca.paa"; }; class TaskPatrol { displayName = CSTRING(Module_TaskPatrol_DisplayName); - statement = QUOTE([ARR_2(_groups, _objects)] call FUNC(setPatrol)); + statement = QUOTE([ARR_2(_groups,_objects)] call FUNC(setPatrol)); icon = "\A3\3DEN\Data\CfgWaypoints\Loiter_ca.paa"; }; class TaskReset { displayName = CSTRING(Module_TaskReset_DisplayName); - statement = QUOTE([ARR_2(_groups, _objects)] call FUNC(setReset)); + statement = QUOTE([ARR_2(_groups,_objects)] call FUNC(setReset)); icon = "\a3\3DEN\Data\CfgWaypoints\cycle_ca.paa"; }; }; @@ -46,17 +46,17 @@ class ZEN_context_menu_actions { condition = QUOTE((_groups isNotEqualTo []) || (_objects isNotEqualTo [])); class TaskCreep { displayName = CSTRING(Module_TaskCreep_DisplayName); - statement = QUOTE([ARR_2(_groups, _objects)] call FUNC(setCreep)); + statement = QUOTE([ARR_2(_groups,_objects)] call FUNC(setCreep)); icon = "\a3\3DEN\Data\CfgWaypoints\Sentry_ca.paa"; }; class TaskHunt { displayName = CSTRING(Module_TaskHunt_DisplayName); - statement = QUOTE([ARR_2(_groups, _objects)] call FUNC(setHunt)); + statement = QUOTE([ARR_2(_groups,_objects)] call FUNC(setHunt)); icon = "\a3\3DEN\Data\CfgWaypoints\Sentry_ca.paa"; }; class TaskRush { displayName = CSTRING(Module_TaskRush_DisplayName); - statement = QUOTE([ARR_2(_groups, _objects)] call FUNC(setRush)); + statement = QUOTE([ARR_2(_groups,_objects)] call FUNC(setRush)); icon = "\a3\3DEN\Data\CfgWaypoints\Sentry_ca.paa"; }; }; diff --git a/addons/wp/modules.hpp b/addons/wp/modules.hpp index ea39a8d4..c50efa5c 100644 --- a/addons/wp/modules.hpp +++ b/addons/wp/modules.hpp @@ -606,7 +606,6 @@ class GVAR(TaskRush) : GVAR(BaseModule) { validate = "number"; condition = "0"; typeName = "NUMBER"; - defaultValue = TASK_RUSH_CYCLETIME; }; class ModuleDescription: ModuleDescription {}; }; diff --git a/addons/wp/settings.sqf b/addons/wp/settings.inc.sqf similarity index 100% rename from addons/wp/settings.sqf rename to addons/wp/settings.inc.sqf diff --git a/hemtt.toml b/hemtt.toml deleted file mode 100644 index 32c5c861..00000000 --- a/hemtt.toml +++ /dev/null @@ -1,113 +0,0 @@ -name = "LAMBS Danger" -prefix = "lambs" -author = "LAMBS Dev Team" -sig_version = 3 -version = "2.6.0" -reuse_private_key = false -files = [ - "mod.cpp", - "*.paa", - "LICENSE", - "readme.txt", - "readme.md" -] -include = ["./include"] - -key_name = "{{prefix}}_danger_{{version}}" -authority = "{{prefix}}_danger_{{version}}-{{git \"id 8\"}}" - -check = [ - "!version_set", - "!compile_scripts" -] - -postbuild = [ - "!version_unset", - "!remove_compiled_scripts" -] - -releasebuild = [ - "!version_set_release", - "@zip @LambsDanger_{{semver.major}}_{{semver.minor}}_{{semver.patch}}" -] - -[header_exts] -version = "{{version}}_{{git \"id 8\"}}" - -[scripts.version_set] -steps_linux = [ - "echo 'Setting version'", - "sed -i -r -s 's/#define MAJOR 0/#define MAJOR {{semver.major}}/g' addons/main/script_version.hpp", - "sed -i -r -s 's/#define MINOR 0/#define MINOR {{semver.minor}}/g' addons/main/script_version.hpp", - "sed -i -r -s 's/#define PATCHLVL 0/#define PATCHLVL {{semver.patch}}/g' addons/main/script_version.hpp", -] -steps_windows = [ - "echo 'Setting version'", - "powershell -Command foreach ($f in 'addons/main/script_version.hpp') {(Get-Content $f) -replace '#define MAJOR 0', '#define MAJOR {{semver.major}}' -join \"`n\" ^| Set-Content -NoNewline $f; Add-Content -NoNewline \"`n\" $f}", - "powershell -Command foreach ($f in 'addons/main/script_version.hpp') {(Get-Content $f) -replace '#define MINOR 0', '#define MINOR {{semver.minor}}' -join \"`n\" ^| Set-Content -NoNewline $f; Add-Content -NoNewline \"`n\" $f}", - "powershell -Command foreach ($f in 'addons/main/script_version.hpp') {(Get-Content $f) -replace '#define PATCHLVL 0', '#define PATCHLVL {{semver.patch}}' -join \"`n\" ^| Set-Content -NoNewline $f; Add-Content -NoNewline \"`n\" $f}", -] -only_release = true -show_output = true - -[scripts.version_unset] -steps_linux = [ - "echo 'Unsetting version'", - "sed -i -r -s 's/#define MAJOR {{semver.major}}/#define MAJOR 0/g' addons/main/script_version.hpp", - "sed -i -r -s 's/#define MINOR {{semver.minor}}/#define MINOR 0/g' addons/main/script_version.hpp", - "sed -i -r -s 's/#define PATCHLVL {{semver.patch}}/#define PATCHLVL 0/g' addons/main/script_version.hpp", -] -steps_windows = [ - "echo 'Unsetting version'", - "powershell -Command foreach ($f in 'addons/main/script_version.hpp') {(Get-Content $f) -replace '#define MAJOR {{semver.major}}', '#define MAJOR 0' -join \"`n\" ^| Set-Content -NoNewline $f; Add-Content -NoNewline \"`n\" $f}", - "powershell -Command foreach ($f in 'addons/main/script_version.hpp') {(Get-Content $f) -replace '#define MINOR {{semver.minor}}', '#define MINOR 0' -join \"`n\" ^| Set-Content -NoNewline $f; Add-Content -NoNewline \"`n\" $f}", - "powershell -Command foreach ($f in 'addons/main/script_version.hpp') {(Get-Content $f) -replace '#define PATCHLVL {{semver.patch}}', '#define PATCHLVL 0' -join \"`n\" ^| Set-Content -NoNewline $f; Add-Content -NoNewline \"`n\" $f}", -] -only_release = true -show_output = true - -[scripts.version_set_release] -steps_linux = [ - "sed -i -r -s 's/\\{version\\}/{{semver.major}}.{{semver.minor}}.{{semver.patch}}/g' releases/{{semver.major}}.{{semver.minor}}.{{semver.patch}}/@lambs/mod.cpp", -] -steps_windows = [ - "powershell -Command foreach ($f in 'releases/{{semver.major}}.{{semver.minor}}.{{semver.patch}}/@lambs/mod.cpp') {(Get-Content $f) -replace '{version}', '{{semver.major}}.{{semver.minor}}.{{semver.patch}}' -join \"`n\" ^| Set-Content -NoNewline $f; Add-Content -NoNewline \"`n\" $f}", -] -only_release = true -show_output = true - -[scripts.uncomment_isdev] -steps_linux = [ - "echo 'Uncommenting #define ISDEV'", - "sed -i -r -s 's:// #define ISDEV:#define ISDEV:g' addons/Streamator/macros.hpp", -] -steps_windows = [ - "echo 'Uncommenting #define ISDEV'", - "powershell -Command foreach ($f in 'addons/Streamator/macros.hpp') {(Get-Content $f) -replace '// #define ISDEV', '#define ISDEV' -join \"`n\" ^| Set-Content -NoNewline $f; Add-Content -NoNewline \"`n\" $f}", -] - -only_release = true -show_output = true - -[scripts.compile_scripts] -steps_windows = [ - "echo 'Compile Arma Scripts'", - "ArmaScriptCompiler.exe" -] - -steps_linux = [ - "echo 'Compiling Arma Scripts does not work yet on Linux'" -] -only_release = true -show_output = false - -[scripts.remove_compiled_scripts] -steps_windows = [ - "echo 'remove Compiled Scripts'", - "powershell -Command Remove-Item './addons/*' -Recurse -Include *.sqfc" -] -steps_linux = [ - "echo 'Compiling Arma Scripts does not work yet on Linux'" -] -only_release = true -show_output = true diff --git a/include/a3/ui_f/hpp/defineDIKCodes.inc b/include/a3/ui_f/hpp/defineDIKCodes.inc new file mode 100644 index 00000000..c641d601 --- /dev/null +++ b/include/a3/ui_f/hpp/defineDIKCodes.inc @@ -0,0 +1,190 @@ +#ifndef DIK_ESCAPE + +/**************************************************************************** + * + * DirectInput keyboard scan codes + * + ****************************************************************************/ + +#define DIK_ESCAPE 0x01 +#define DIK_1 0x02 +#define DIK_2 0x03 +#define DIK_3 0x04 +#define DIK_4 0x05 +#define DIK_5 0x06 +#define DIK_6 0x07 +#define DIK_7 0x08 +#define DIK_8 0x09 +#define DIK_9 0x0A +#define DIK_0 0x0B +#define DIK_MINUS 0x0C /* - on main keyboard */ +#define DIK_EQUALS 0x0D +#define DIK_BACK 0x0E /* backspace */ +#define DIK_TAB 0x0F +#define DIK_Q 0x10 +#define DIK_W 0x11 +#define DIK_E 0x12 +#define DIK_R 0x13 +#define DIK_T 0x14 +#define DIK_Y 0x15 +#define DIK_U 0x16 +#define DIK_I 0x17 +#define DIK_O 0x18 +#define DIK_P 0x19 +#define DIK_LBRACKET 0x1A +#define DIK_RBRACKET 0x1B +#define DIK_RETURN 0x1C /* Enter on main keyboard */ +#define DIK_LCONTROL 0x1D +#define DIK_A 0x1E +#define DIK_S 0x1F +#define DIK_D 0x20 +#define DIK_F 0x21 +#define DIK_G 0x22 +#define DIK_H 0x23 +#define DIK_J 0x24 +#define DIK_K 0x25 +#define DIK_L 0x26 +#define DIK_SEMICOLON 0x27 +#define DIK_APOSTROPHE 0x28 +#define DIK_GRAVE 0x29 /* accent grave */ +#define DIK_LSHIFT 0x2A +#define DIK_BACKSLASH 0x2B +#define DIK_Z 0x2C +#define DIK_X 0x2D +#define DIK_C 0x2E +#define DIK_V 0x2F +#define DIK_B 0x30 +#define DIK_N 0x31 +#define DIK_M 0x32 +#define DIK_COMMA 0x33 +#define DIK_PERIOD 0x34 /* . on main keyboard */ +#define DIK_SLASH 0x35 /* / on main keyboard */ +#define DIK_RSHIFT 0x36 +#define DIK_MULTIPLY 0x37 /* * on numeric keypad */ +#define DIK_LMENU 0x38 /* left Alt */ +#define DIK_SPACE 0x39 +#define DIK_CAPITAL 0x3A +#define DIK_F1 0x3B +#define DIK_F2 0x3C +#define DIK_F3 0x3D +#define DIK_F4 0x3E +#define DIK_F5 0x3F +#define DIK_F6 0x40 +#define DIK_F7 0x41 +#define DIK_F8 0x42 +#define DIK_F9 0x43 +#define DIK_F10 0x44 +#define DIK_NUMLOCK 0x45 +#define DIK_SCROLL 0x46 /* Scroll Lock */ +#define DIK_NUMPAD7 0x47 +#define DIK_NUMPAD8 0x48 +#define DIK_NUMPAD9 0x49 +#define DIK_SUBTRACT 0x4A /* - on numeric keypad */ +#define DIK_NUMPAD4 0x4B +#define DIK_NUMPAD5 0x4C +#define DIK_NUMPAD6 0x4D +#define DIK_ADD 0x4E /* + on numeric keypad */ +#define DIK_NUMPAD1 0x4F +#define DIK_NUMPAD2 0x50 +#define DIK_NUMPAD3 0x51 +#define DIK_NUMPAD0 0x52 +#define DIK_DECIMAL 0x53 /* . on numeric keypad */ +#define DIK_OEM_102 0x56 /* < > | on UK/Germany keyboards */ +#define DIK_F11 0x57 +#define DIK_F12 0x58 + +#define DIK_F13 0x64 /* (NEC PC98) */ +#define DIK_F14 0x65 /* (NEC PC98) */ +#define DIK_F15 0x66 /* (NEC PC98) */ + +#define DIK_KANA 0x70 /* (Japanese keyboard) */ +#define DIK_ABNT_C1 0x73 /* / ? on Portugese (Brazilian) keyboards */ +#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ +#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ +#define DIK_YEN 0x7D /* (Japanese keyboard) */ +#define DIK_ABNT_C2 0x7E /* Numpad . on Portugese (Brazilian) keyboards */ +#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ +#define DIK_PREVTRACK 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIK_AT 0x91 /* (NEC PC98) */ +#define DIK_COLON 0x92 /* (NEC PC98) */ +#define DIK_UNDERLINE 0x93 /* (NEC PC98) */ +#define DIK_KANJI 0x94 /* (Japanese keyboard) */ +#define DIK_STOP 0x95 /* (NEC PC98) */ +#define DIK_AX 0x96 /* (Japan AX) */ +#define DIK_UNLABELED 0x97 /* (J3100) */ +#define DIK_NEXTTRACK 0x99 /* Next Track */ +#define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ +#define DIK_RCONTROL 0x9D +#define DIK_MUTE 0xA0 /* Mute */ +#define DIK_CALCULATOR 0xA1 /* Calculator */ +#define DIK_PLAYPAUSE 0xA2 /* Play / Pause */ +#define DIK_MEDIASTOP 0xA4 /* Media Stop */ +#define DIK_VOLUMEDOWN 0xAE /* Volume - */ +#define DIK_VOLUMEUP 0xB0 /* Volume + */ +#define DIK_WEBHOME 0xB2 /* Web home */ +#define DIK_NUMPADCOMMA 0xB3 /* , on numeric keypad (NEC PC98) */ +#define DIK_DIVIDE 0xB5 /* / on numeric keypad */ +#define DIK_SYSRQ 0xB7 +#define DIK_RMENU 0xB8 /* right Alt */ +#define DIK_PAUSE 0xC5 /* Pause */ +#define DIK_HOME 0xC7 /* Home on arrow keypad */ +#define DIK_UP 0xC8 /* UpArrow on arrow keypad */ +#define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ +#define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ +#define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ +#define DIK_END 0xCF /* End on arrow keypad */ +#define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ +#define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ +#define DIK_INSERT 0xD2 /* Insert on arrow keypad */ +#define DIK_DELETE 0xD3 /* Delete on arrow keypad */ +#define DIK_LWIN 0xDB /* Left Windows key */ +#define DIK_RWIN 0xDC /* Right Windows key */ +#define DIK_APPS 0xDD /* AppMenu key */ +#define DIK_POWER 0xDE /* System Power */ +#define DIK_SLEEP 0xDF /* System Sleep */ +#define DIK_WAKE 0xE3 /* System Wake */ +#define DIK_WEBSEARCH 0xE5 /* Web Search */ +#define DIK_WEBFAVORITES 0xE6 /* Web Favorites */ +#define DIK_WEBREFRESH 0xE7 /* Web Refresh */ +#define DIK_WEBSTOP 0xE8 /* Web Stop */ +#define DIK_WEBFORWARD 0xE9 /* Web Forward */ +#define DIK_WEBBACK 0xEA /* Web Back */ +#define DIK_MYCOMPUTER 0xEB /* My Computer */ +#define DIK_MAIL 0xEC /* Mail */ +#define DIK_MEDIASELECT 0xED /* Media Select */ + +/* + * Alternate names for keys, to facilitate transition from DOS. + */ +#define DIK_BACKSPACE DIK_BACK /* backspace */ +#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ +#define DIK_LALT DIK_LMENU /* left Alt */ +#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ +#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ +#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ +#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ +#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ +#define DIK_RALT DIK_RMENU /* right Alt */ +#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ +#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ +#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ +#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ +#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ +#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ + +/* + * Alternate names for keys originally not used on US keyboards. + */ +#define DIK_CIRCUMFLEX DIK_PREVTRACK /* Japanese keyboard */ + + +/* + * Combination keys + */ +#define INPUT_CTRL_OFFSET 512 +#define INPUT_SHIFT_OFFSET 1024 +#define INPUT_ALT_OFFSET 2048 + + +#endif /* DIK_ESCAPE */ + diff --git a/tools/stringtableChecker/duplicatedEntry.js b/tools/nodejs_tools/duplicatedEntry.js similarity index 77% rename from tools/stringtableChecker/duplicatedEntry.js rename to tools/nodejs_tools/duplicatedEntry.js index 6fae455a..aba1a7f6 100644 --- a/tools/stringtableChecker/duplicatedEntry.js +++ b/tools/nodejs_tools/duplicatedEntry.js @@ -5,8 +5,7 @@ const fs = require('fs'); const EOL = require('os').EOL; const path = require('path'); const xml = require("xml2js"); -const { Console } = require('console'); -const { fail } = require('assert'); +const core = require('@actions/core'); const PREFIX = "Lambs"; @@ -38,14 +37,14 @@ function getDirFiles(p, module) { projectFiles.push(data); if (!file.endsWith(".xml")) continue; filePath = path.join(p, file); - var xmlData = fs.readFileSync(filePath).toString(); + var xmlData = fs.readFileSync(filePath, { encoding: 'utf8', flag: 'r' }); running++; xml.parseString(xmlData, function (err, result) { if (result.Project.Package[0].Key) { - ParseString(result.Project.Package[0].Key); + ParseString(result.Project.Package[0].Key, filePath, xmlData); } else if (result.Project.Package[0].Container) { for (const entry of result.Project.Package[0].Container) { - ParseString(entry.Key); + ParseString(entry.Key, filePath, xmlData); } } running--; @@ -54,14 +53,21 @@ function getDirFiles(p, module) { } } -function ParseString(Keys) { +function ParseString(Keys, file, data) { for (const entry of Keys) { for (const key in entry) { - if (key != "$" && entry.hasOwnProperty(key)) { + if (key != "$" && Object.hasOwnProperty.call(entry, key)) { const element = entry[key][0]; const index = stringtableEntries.indexOf(element); if (index != -1 && !stringtableIDs.includes(entry.$.ID)) { const log = `${entry.$.ID} is a Duplicated string ${stringtableIDs[index]} : ${key}`; + + var start_line = data.split("\n").findIndex(x => x.includes(key)); + core.warning(log, { + file: file, + startLine: start_line, + }) + fs.appendFileSync("duplicated.log", log + EOL); console.log(log); failedCount++; @@ -75,7 +81,7 @@ function ParseString(Keys) { getDirFiles("addons", ""); -while (running != 0) {} +while (running != 0) { } if (failedCount == 0) { console.log("No Duplicated Entrys found"); } else { diff --git a/tools/nodejs_tools/hemttchecker.js b/tools/nodejs_tools/hemttchecker.js new file mode 100644 index 00000000..df020ca0 --- /dev/null +++ b/tools/nodejs_tools/hemttchecker.js @@ -0,0 +1,35 @@ +const fs = require('fs'); +const core = require('@actions/core'); + +if (!fs.existsSync('.hemttout/ci_annotations.txt')) return; + +const ci_annotations = fs.readFileSync('.hemttout/ci_annotations.txt', { encoding: 'utf8', flag: 'r' }).split('\n'); + +for (const annotation of ci_annotations) { + if (annotation === '') continue; + const [start_line, end_line, start_column, end_column, type, message, recommendation, file] = annotation.split('||'); + var data = { + file: file, + startLine: parseInt(start_line), + endLine: parseInt(end_line), + title: recommendation, + }; + if (start_line === end_line) { + data.startColumn = start_column; + data.endColumn = end_column; + } + switch (type) { + case 'error': + core.error(message, data); + break; + case 'warning': + core.warning(message, data); + break; + case 'notice': + core.notice(message, data); + break; + default: + core.warning(message, data); + break; + } +} diff --git a/tools/nodejs_tools/package-lock.json b/tools/nodejs_tools/package-lock.json new file mode 100644 index 00000000..6e0fbb0d --- /dev/null +++ b/tools/nodejs_tools/package-lock.json @@ -0,0 +1,95 @@ +{ + "name": "stringtableChecker", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "stringtableChecker", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@actions/core": "^1.10.1", + "xml2js": "^0.5.0" + } + }, + "node_modules/@actions/core": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz", + "integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==", + "dependencies": { + "@actions/http-client": "^2.0.1", + "uuid": "^8.3.2" + } + }, + "node_modules/@actions/http-client": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.0.tgz", + "integrity": "sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==", + "dependencies": { + "tunnel": "^0.0.6", + "undici": "^5.25.4" + } + }, + "node_modules/@fastify/busboy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", + "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", + "engines": { + "node": ">=14" + } + }, + "node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } + }, + "node_modules/undici": { + "version": "5.28.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/xml2js": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "engines": { + "node": ">=4.0" + } + } + } +} diff --git a/tools/stringtableChecker/package.json b/tools/nodejs_tools/package.json similarity index 90% rename from tools/stringtableChecker/package.json rename to tools/nodejs_tools/package.json index 0f7348c5..8dbbec46 100644 --- a/tools/stringtableChecker/package.json +++ b/tools/nodejs_tools/package.json @@ -10,6 +10,7 @@ "author": "", "license": "ISC", "dependencies": { + "@actions/core": "^1.10.1", "xml2js": "^0.5.0" } } diff --git a/tools/prepchecker.js b/tools/nodejs_tools/prepchecker.js similarity index 86% rename from tools/prepchecker.js rename to tools/nodejs_tools/prepchecker.js index b0750507..d5f14ff5 100644 --- a/tools/prepchecker.js +++ b/tools/nodejs_tools/prepchecker.js @@ -4,6 +4,7 @@ const path = require('path'); const fs = require('fs'); +const core = require('@actions/core'); const PREFIX = "Lambs"; @@ -52,7 +53,7 @@ function getDirFiles(p, module) { }; function getFunctions(file, module) { - let content = fs.readFileSync(file).toString(); + let content = fs.readFileSync(file, { encoding: 'utf8', flag: 'r' }); content = content.replace(commentRegex, ''); let match; @@ -85,6 +86,7 @@ function CheckFunctions() { } let content = fs.readFileSync(data.path).toString(); + const lines = content.split("\n") content = content.replace(commentRegex, ''); let match; while ((match = funcPrep.exec(content)) !== null) { @@ -101,6 +103,17 @@ function CheckFunctions() { if (fncName) { if (!prepedFunctions.includes(fncName.toLowerCase())) { console.log(`Use of not Existing Functions: ${fncName} in ${data.path}`) + var key; + if (match[1]) { + key = `FUNC(${match[1]})`; + } else if (match[2] && match[3]) { + key = `EFUNC(${match[2]},${match[3]})`; + } + var line = lines.findIndex(x => x.includes(key)) + core.error(`Use of not Existing Functions: ${fncName}`, { + file: data.path, + startLine: line + }); failedCount++; } } diff --git a/tools/stringtableChecker/stringTableChecker.js b/tools/nodejs_tools/stringTableChecker.js similarity index 89% rename from tools/stringtableChecker/stringTableChecker.js rename to tools/nodejs_tools/stringTableChecker.js index a0c73275..cfd16c58 100644 --- a/tools/stringtableChecker/stringTableChecker.js +++ b/tools/nodejs_tools/stringTableChecker.js @@ -4,7 +4,8 @@ const fs = require('fs'); const path = require('path'); const xml = require("xml2js"); -const { Console } = require('console'); +const core = require('@actions/core'); + const PREFIX = "Lambs"; @@ -73,6 +74,11 @@ function CheckStringtables() { stringtableEntries[strName] = true; } else { console.log(`Stringtable Entry ${strName} does not exist in ${data.path}`); + core.notice(`Stringtable Entry ${strName} does not exist`, { + title: "Missing Stringtable Entry", + file: data.path, + }); + failedCount++; } } @@ -80,6 +86,9 @@ function CheckStringtables() { for (var stringtableEntry in stringtableEntries) { if (stringtableEntries.hasOwnProperty(stringtableEntry) && !stringtableEntries[stringtableEntry]) { console.log(`Stringtable Entry ${stringtableEntry} is Unused!`); + core.notice(`Stringtable Entry ${stringtableEntry} is Unused!`, { + title: "Unused Stringtable Entry", + }); } } } diff --git a/tools/stringtableChecker/package-lock.json b/tools/stringtableChecker/package-lock.json deleted file mode 100644 index 2a96f2d5..00000000 --- a/tools/stringtableChecker/package-lock.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "stringtableChecker", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" - }, - "xml2js": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", - "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", - "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" - } - }, - "xmlbuilder": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", - "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" - } - } -}