Initial Repo Setup
All checks were successful
Build / Build (push) Successful in 1m41s

This commit is contained in:
Jacob Schmidt 2024-11-10 14:33:22 -06:00
commit 885cc267c5
64 changed files with 4492 additions and 0 deletions

32
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,32 @@
---
name: Bug report
about: Report a bug related to the framework.
title: "[addon name] - [short description]"
labels: bug
assignees: JSchmidt92
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Mission file**
The mission where the issue occured.
**Log file**
The log file generated by the game.
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: Request - [short description]
labels: ''
assignees: JSchmidt92
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

4
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,4 @@
**When merged this pull request will:**
- Describe what this pull request will do
- Each change in a separate line
- Follow title standard `Module - Add|Fix|Improve|Change|Remove things`

33
.github/release_drafter.yml vendored Normal file
View File

@ -0,0 +1,33 @@
branches:
- master
name-template: "ArmaDragonflyClient_v$NEXT_PATCH_VERSION"
tag-template: "$NEXT_PATCH_VERSION"
categories:
- title: "**ADDED:**"
labels:
- "feature"
- title: "**FIXED:**"
labels:
- "bug fix"
- title: "**IMPROVED:**"
labels:
- "enhancement"
- title: "**CHANGED:**"
labels:
- "cleanup"
exclude-labels:
- "ignore changelog"
change-template: "- $TITLE (#$NUMBER)"
template: |
## Change Log Summary
$CHANGES
replacers:
# Category titles
- search: '/\#\# (\*\*(ADDED|FIXED|IMPROVED|CHANGED):\*\*)/g'
replace: "$1"

49
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: Build
on:
push:
branches: [master]
paths-ignore:
- ".github/**"
- "addons/main/script_version.hpp"
- "docs/**"
- "tools/**"
- "LICENSE"
- "README.md"
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Bump Version
id: bump-version
run: python3 tools/version_bumper.py increment_build push_commit
- name: Setup HEMTT
uses: arma-actions/hemtt@v1
- name: Run HEMTT build
run: hemtt release
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Initialize or Update Go module
run: |
if [ ! -f go.mod ]; then
go mod init gitea.innovativedevsolutions.org/IDSolutions/ramdb
fi
go get code.gitea.io/sdk/gitea
- name: Run Release Action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.bump-version.outputs.VERSION }}
run: go run main.go

410
.gitignore vendored Normal file
View File

@ -0,0 +1,410 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
# Hemtt
*.pbo
.hemttout
hemtt
hemtt.exe
*.biprivatekey
# Added by cargo
/target

21
.hemtt/project.toml Normal file
View File

@ -0,0 +1,21 @@
name = "ArmaRAMDb"
author = "IDSolutions"
prefix = "ramdb"
mainprefix = "z"
[files]
include = [
"*.dll",
"*.so",
"*.json",
"mod.cpp",
"README.md",
"LICENSE",
"icon_64_ca.paa",
"icon_128_ca.paa",
"icon_128_highlight_ca.paa",
"title_co.paa"
]
[version]
git_hash = 0

View File

@ -0,0 +1 @@
HEMTT_RFS.join("extension").join("bin").join("Release").join("net8.0").join("win-x64").join("publish").join("ArmaRAMDb_x64.dll").copy(HEMTT_RFS.join("ArmaRAMDb_x64.dll"));

BIN
ArmaRAMDb_x64.dll Normal file

Binary file not shown.

121
LICENSE Normal file
View File

@ -0,0 +1,121 @@
Copyright (c) 2024 Jacob "J.Schmidt92" Schmidt and "Creedcoder"
Brief summary of this Licence
PLEASE, NOTE THAT THIS SUMMARY HAS NO LEGAL EFFECT AND IS ONLY OF AN INFORMATORY NATURE DESIGNED FOR YOU TO GET THE BASIC INFORMATION ABOUT THE CONTENT OF THIS LICENCE. THE ONLY LEGALLY BINDING PROVISIONS ARE THOSE IN THE ORIGINAL AND FULL TEXT OF THIS LICENCE.
With this licence you are free to adapt (i.e. modify, rework or update) and share (i.e. copy, distribute or transmit) the material under the following conditions:
Attribution - You must attribute the material in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the material).
Noncommercial - You may not use this material for any commercial purposes.
Arma Only - You may not convert or adapt this material to be used in other games than Arma.
Share Alike - If you adapt, or build upon this material, you may distribute the resulting material only under the same license.
Full version of licence
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Arma Public License - Share Alike ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 Definitions
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
ArmaOnly means primarily intended for or directed towards the use in any of existing and future Arma games, including but not limited to Arma: Cold War Assault, Arma, Arma 2 and Arma 3 and its official sequels and expansion packs.
Arma Public Share Alike Compatible License means a license listed at https://www.bohemia.net/community/licenses as essentially the equivalent of this Public License.
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 Scope
License grant
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
reproduce and Share the Licensed Material, in whole or in part, for NonCommercial and ArmaOnly purposes only; and
produce, reproduce, and Share Adapted Material for NonCommercial and ArmaOnly purposes only.
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
Term. The term of this Public License is specified in Section 6(a).
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
Downstream recipients.
Offer from the Licensor Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
Additional offer from the Licensor Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapters License You apply.
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(a)(i).
Other rights
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
Patent and trademark rights are not licensed under this Public License.
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial and ArmaOnly purposes.
Section 3 License Conditions
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
Attribution
If You Share the Licensed Material (including in modified form), You must:
retain the following if it is supplied by the Licensor with the Licensed Material:
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
a copyright notice;
a notice that refers to this Public License;
a notice that refers to the disclaimer of warranties;
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(a) to the extent reasonably practicable.
ShareAlike
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
The Adapters License You apply must be this Public License, or an Arma Public Share Alike Compatible License.
You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
Section 4 Sui Generis Database Rights
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial and ArmaOnly purposes only;
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 Interpretation
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
Bohemia Interactive Notices
Bohemia Interactive a.s. is not a party to this License, and makes no warranty whatsoever in connection with the Licensed Material. Bohemia Interactive a.s. will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, Bohemia Interactive a.s. may elect to apply the Public License to material it publishes and in those instances it becomes the "Licensor".
Except for the limited purpose of indicating to the public that the Licensed Material is shared under this Public License, Bohemia Interactive a.s. does not authorize the use by either party of the trademarks "Arma", "Bohemia Interactive" or any related trademark or logo of Arma or Bohemia Interactive without the prior written consent of Bohemia Interactive a.s.

23
README.md Normal file
View File

@ -0,0 +1,23 @@
<p align="center">
<a href="https://gitea.innovativedevsolutions.org/IDSolutions/ramdb/releases/latest" target="blank">
<img src="https://img.shields.io/gitea/v/release/IDSolutions/ramdb?gitea_url=https%3A%2F%2Fgitea.innovativedevsolutions.org" alt="latest-release" /></a>
<a href="https://gitea.innovativedevsolutions.org/IDSolutions/ramdb/issues" target="blank">
<img src="https://img.shields.io/gitea/issues/open/IDSolutions/ramdb?gitea_url=https%3A%2F%2Fgitea.innovativedevsolutions.org" alt="open-issues" /></a>
<a href="https://gitea.innovativedevsolutions.org/IDSolutions/ramdb/actions?workflow=build.yml" target="blank">
<img src="https://gitea.innovativedevsolutions.org/IDSolutions/ramdb/actions/workflows/build.yml/badge.svg?branch=master" alt="build-status" /></a>
</p>
Welcome to **ArmaRAMDb**.
Experience next-level persistence in Arma 3 with our mod powered by C# .NET 8. This ultra-fast in-memory data store offers unparalleled performance and scalability for your Arma 3 gameplay data management needs.
If something is broken, contact **J. Schmidt92** or open a new issue on **[Gitea](https://gitea.innovativedevsolutions.org/IDSolutions/ramdb/issues)**.
</br>
**For more information, [read the Docs.](#)**
**For Roadmap, [visit the project page.](https://gitea.innovativedevsolutions.org/IDSolutions/ramdb/projects)** _(WIP)_
## Contributors
* **_Creedcoder_** for his contributions, help, input and time

1
addons/db/$PBOPREFIX$ Normal file
View File

@ -0,0 +1 @@
z\ramdb\addons\db

View File

@ -0,0 +1,19 @@
class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preStart));
};
};
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
serverInit = QUOTE(call COMPILE_FILE(XEH_preInit_server));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
clientInit = QUOTE(call COMPILE_FILE(XEH_postInit_client));
};
};

0
addons/db/XEH_PREP.hpp Normal file
View File

View File

@ -0,0 +1,15 @@
#include "script_component.hpp"
GVAR(isProcessing) = false;
GVAR(fetchArray) = [];
GVAR(taskQueue) = [];
// addMissionEventHandler ["ExtensionCallback", {
// params ["_name", "_function", "_data"];
// diag_log _this;
// if (_name isEqualTo "ArmaRAMDb") then {
// parseSimpleArray _data call (missionNamespace getVariable [_function, {
// hint "Function does not exist!"
// }]);
// };
// }];

View File

@ -0,0 +1 @@
#include "script_component.hpp"

View File

@ -0,0 +1,8 @@
#include "script_component.hpp"
ADDON = false;
PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
ADDON = true;

View File

@ -0,0 +1 @@
#include "script_component.hpp"

View File

@ -0,0 +1,2 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"

16
addons/db/config.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ramdb_main"};
authors[] = {"J. Schmidt", "Creedcoder"};
author = "IDSolutions";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"

View File

@ -0,0 +1,15 @@
#define COMPONENT db
#define COMPONENT_BEAUTIFIED DB
#include "..\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
#ifdef DEBUG_ENABLED_DB
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_DB
#define DEBUG_SETTINGS DEBUG_SETTINGS_DB
#endif
#include "..\main\script_macros.hpp"

1
addons/main/$PBOPREFIX$ Normal file
View File

@ -0,0 +1 @@
z\ramdb\addons\main

14
addons/main/CfgMods.hpp Normal file
View File

@ -0,0 +1,14 @@
class CfgMods {
class PREFIX {
dir = "@ArmaRAMDb";
name = "ArmaRAMDb";
author = "IDSolutions";
picture = "title_co.paa";
hideName = "false";
hidePicture = "false";
action = "https://innovativedevsolutions.org/";
actionName = "Website";
description = "Innovative Dev Solutions";
dlcColor[] = {1, 0.0, 0.86, 1};
};
};

16
addons/main/config.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {};
authors[] = {"Jacob Schmidt", "Creedcoder"};
author = "IDSolutions";
VERSION_CONFIG;
};
};
#include "CfgMods.hpp"

View File

@ -0,0 +1,14 @@
#define COMPONENT main
#include "\z\ramdb\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
#ifdef DEBUG_ENABLED_MAIN
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_MAIN
#define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN
#endif
#include "\z\ramdb\addons\main\script_macros.hpp"

View File

@ -0,0 +1,13 @@
#include "\z\ace\addons\main\script_macros.hpp"
#define AFUNC(var1,var2) TRIPLES(DOUBLES(ace,var1),fnc,var2)
#define BFUNC(var1) TRIPLES(BIS,fnc,var1)
#define CFUNC(var1) TRIPLES(CBA,fnc,var1)
#ifdef DISABLE_COMPILE_CACHE
#undef PREP
#define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QPATHTOF(functions\DOUBLES(fnc,fncName).sqf)
#else
#undef PREP
#define PREP(fncName) [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf), QFUNC(fncName)] call CBA_fnc_compileFunction
#endif

View File

@ -0,0 +1,15 @@
#define MAINPREFIX z
#define PREFIX dragonfly
#include "script_version.hpp"
#define VERSION MAJOR.MINOR
#define VERSION_AR MAJOR,MINOR,PATCH,BUILD
#define REQUIRED_VERSION 2.12
#ifdef COMPONENT_BEAUTIFIED
#define COMPONENT_NAME QUOTE(DRAGONFLY - COMPONENT_BEAUTIFIED)
#else
#define COMPONENT_NAME QUOTE(DRAGONFLY - COMPONENT)
#endif

View File

@ -0,0 +1,4 @@
#define MAJOR 1
#define MINOR 0
#define PATCH 0
#define BUILD 0

5
config.xml Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ArmaRAMDb>
<Context>false</Context>
<Debug>false</Debug>
</ArmaRAMDb>

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>Enable</ImplicitUsings>
<Nullable>Disable</Nullable>
<AssemblyName>$(MSBuildProjectName)_x64</AssemblyName>
<RootNamespace>ArmaRAMDb</RootNamespace>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
</Project>

22
extension/ArmaRAMDb.sln Normal file
View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArmaRAMDb", "ArmaRAMDb.csproj", "{D37881F7-26D5-404C-A9D7-DB022101EFA8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D37881F7-26D5-404C-A9D7-DB022101EFA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D37881F7-26D5-404C-A9D7-DB022101EFA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D37881F7-26D5-404C-A9D7-DB022101EFA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D37881F7-26D5-404C-A9D7-DB022101EFA8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,86 @@
using System.Collections.Concurrent;
namespace ArmaRAMDb
{
internal class HashStore
{
private static readonly ConcurrentDictionary<string, ConcurrentDictionary<string, string>> _hashTables = RAMDb._hashTables;
public static bool HashSet(string tableName, string key, string value)
{
var table = _hashTables.GetOrAdd(tableName, _ => new ConcurrentDictionary<string, string>());
table.AddOrUpdate(key, value, (_, _) => value);
Main.Log($"HashSet: {tableName} - {key} - {value}", "debug");
return true;
}
public static bool HashSetBulk(string tableName, Dictionary<string, string> values)
{
var table = _hashTables.GetOrAdd(tableName, _ => new ConcurrentDictionary<string, string>());
foreach (var kv in values)
{
table.AddOrUpdate(kv.Key, kv.Value, (_, _) => kv.Value);
Main.Log($"HashSetBulk: {tableName} - {kv.Key} - {kv.Value}", "debug");
}
return true;
}
public static string HashGet(string tableName, string key)
{
if (_hashTables.TryGetValue(tableName, out var table))
{
string data = table.TryGetValue(key, out string value) ? value : string.Empty;
Main.Log($"HashGet: {tableName} - {key}", "debug");
Main.Log($"Value: {data}", "debug");
return data;
}
Main.Log($"Table not found: {tableName}", "debug");
return string.Empty;
}
public static Dictionary<string, string> HashGetAll(string tableName)
{
Main.Log($"Getting contents for table: {tableName}", "debug");
if (_hashTables.TryGetValue(tableName, out var table))
{
var contents = table.ToDictionary(kv => kv.Key, kv => kv.Value);
Main.Log($"Found {contents.Count} entries in table {tableName}", "debug");
foreach (var entry in contents)
{
Main.Log($"Key: {entry.Key}, Value: {entry.Value}", "debug");
}
return contents;
}
Main.Log($"Table {tableName} not found", "debug");
return [];
}
public static bool HashDelete(string tableName, string key)
{
if (_hashTables.TryGetValue(tableName, out var table))
{
var result = table.TryRemove(key, out _);
Main.Log($"HashDelete: {tableName} - {key} - Success: {result}", "debug");
return result;
}
Main.Log($"Table {tableName} or Key {key} not found", "debug");
return false;
}
public static bool DeleteHashTable(string tableName)
{
var result = _hashTables.TryRemove(tableName, out _);
Main.Log($"DeleteHashTable: {tableName} - Success: {result}", "debug");
return result;
}
}
}

View File

@ -0,0 +1,33 @@
using System.Collections.Concurrent;
namespace ArmaRAMDb
{
internal class KeyValueStore
{
private static readonly ConcurrentDictionary<string, string> _keyValues = RAMDb._keyValues;
public static bool SetValue(string key, string value)
{
_keyValues.AddOrUpdate(key, value, (_, _) => value);
Main.Log($"SetValue: {key} - Value: {value}", "debug");
return true;
}
public static string GetValue(string key)
{
string value = _keyValues.TryGetValue(key, out string data) ? data : string.Empty;
Main.Log($"GetValue: {key} - Value: {value}", "debug");
return value;
}
public static bool DeleteValue(string key)
{
var result = _keyValues.TryRemove(key, out _);
Main.Log($"DeleteValue: {key} - Success: {result}", "debug");
return result;
}
}
}

View File

@ -0,0 +1,88 @@
using System.Collections.Concurrent;
namespace ArmaRAMDb
{
internal class ListStore
{
private static readonly ConcurrentDictionary<string, List<string>> _lists = RAMDb._lists;
public static bool ListPush(string listName, string value)
{
if (_lists.TryGetValue(listName, out var list))
{
lock (list)
{
list.Add(value);
Main.Log($"ListPush: {listName} - Value: {value}", "debug");
return true;
}
}
Main.Log($"List not found: {listName}", "debug");
return false;
}
public static string ListGet(string listName, int index)
{
if (_lists.TryGetValue(listName, out var list))
{
lock (list)
{
string value = index >= 0 && index < list.Count ? list[index] : string.Empty;
Main.Log($"ListGet: {listName} - Index: {index} - Value: {value}", "debug");
return value;
}
}
Main.Log($"List not found: {listName}", "debug");
return string.Empty;
}
public static List<string> GetList(string listName)
{
Main.Log($"Getting contents for list: {listName}", "debug");
if (_lists.TryGetValue(listName, out var list))
{
var contents = new List<string>(list);
Main.Log($"Found {contents.Count} entries in list {listName}", "debug");
foreach (var item in contents)
{
Main.Log($"Value: {item}", "debug");
}
return contents;
}
Main.Log($"List not found: {listName}", "debug");
return [];
}
public static bool ListDelete(string listName, int index)
{
if (_lists.TryGetValue(listName, out var list))
{
lock (list)
{
if (index >= 0 && index < list.Count)
{
string value = list[index];
list.RemoveAt(index);
Main.Log($"ListDelete: {listName} - Index: {index} - Value: {value}", "debug");
return true;
}
}
}
Main.Log($"List not found: {listName}", "debug");
return false;
}
public static bool DeleteList(string listName)
{
var result = _lists.TryRemove(listName, out _);
Main.Log($"DeleteList: {listName} - Success: {result}", "debug");
return result;
}
}
}

332
extension/src/Main.cs Normal file
View File

@ -0,0 +1,332 @@
using System.Runtime.InteropServices;
using System.Text;
using System.Xml.Linq;
namespace ArmaRAMDb
{
public class CallContext
{
public ulong SteamId { get; set; }
public string FileSource { get; set; }
public string MissionName { get; set; }
public string ServerName { get; set; }
public short RemoteExecutedOwner { get; set; }
}
public class Main
{
private const string ARDB_VERSION = "1.0.0";
public static string ARDB_LOGFOLDER { get; private set; } = "\\@ramdb\\logs";
public static bool ARDB_DEBUG {get; private set; } = false;
public static bool ARDB_INITCHECK {get; private set; } = false;
public static string STEAMID {get; private set; } = "";
public static bool ARDB_CONTEXTLOG {get; private set; } = false;
public static IntPtr ARDB_CONTEXT { get; private set; }
private static int numCalls = 0;
public static bool ARDB_ISLOADED { get; private set; } = false;
public static ExtensionCallback Callback { get; private set; }
public delegate int ExtensionCallback([MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string function, [MarshalAs(UnmanagedType.LPStr)] string data);
public static void ARDB_Init()
{
char[] separator = ['='];
string[] commandLineArgs = Environment.GetCommandLineArgs();
string str = "";
for (int index = 0; index < commandLineArgs.Length; index++)
{
string[] strArray = commandLineArgs[index].Split(separator, StringSplitOptions.RemoveEmptyEntries);
if (strArray[0].Equals("-ardb", StringComparison.CurrentCultureIgnoreCase))
{
str = strArray[1];
break;
}
}
if (str == "")
str = "@ramdb\\config.xml";
if (File.Exists(Environment.CurrentDirectory + "\\" + str))
{
List<string> strList = [];
List<string> list = XElement.Load(Environment.CurrentDirectory + "\\" + str).Elements().Select(eintrag => (string)eintrag).ToList();
if (bool.TryParse(list[0], out bool res0))
ARDB_CONTEXTLOG = res0;
if (bool.TryParse(list[1], out bool res1))
ARDB_DEBUG = res1;
Log($"Config file found! Context Mode: {ARDB_CONTEXTLOG}! Debug Mode: {ARDB_DEBUG}!", "action");
}
else
{
Log("Config file not found! Default Settings Loaded.", "action");
}
ARDB_INITCHECK = true;
}
public static void Log(string msg, string type)
{
if (!ARDB_DEBUG)
return;
string logFileName = type + ".log";
string path = Environment.CurrentDirectory + ARDB_LOGFOLDER;
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
using StreamWriter sw = new(Path.Combine(path, logFileName), true);
sw.WriteLine(DateTime.Now.ToString() + " >> " + msg);
}
/// <summary>
/// Called only once when Arma 3 loads the extension.
/// </summary>
/// <param name="func">Pointer to Arma 3's callback function</param>
[UnmanagedCallersOnly(EntryPoint = "RVExtensionRegisterCallback")]
public unsafe static void RVExtensionRegisterCallback(nint func)
{
Callback = Marshal.GetDelegateForFunctionPointer<ExtensionCallback>(func);
}
/// <summary>
/// Called only once when Arma 3 loads the extension.
/// The output will be written in the RPT logs.
/// </summary>
/// <param name="output">A pointer to the output buffer</param>
/// <param name="outputSize">The maximum length of the buffer (always 32 for this particular method)</param>
[UnmanagedCallersOnly(EntryPoint = "RVExtensionVersion")]
#pragma warning disable IDE0060 // Remove unused parameter
public unsafe static void RVExtensionVersion(char* output, int outputSize)
#pragma warning restore IDE0060 // Remove unused parameter
{
WriteOutput(output, ARDB_VERSION);
}
/// <summary>
/// Called before every RVExtension/RVExtensionArgs execution, providing context about where the call came from.
/// </summary>
/// <param name="argv">
/// Array of pointers to null-terminated strings containing:
/// [0] - Steam 64bit UserID
/// [1] - FileSource
/// [2] - MissionName
/// [3] - ServerName
/// [4] - Machine Network ID
/// </param>
/// <param name="argc">Number of arguments in the argv array (always 5).</param>
[UnmanagedCallersOnly(EntryPoint = "RVExtensionContext")]
public unsafe static int RVExtensionContext(char** argv, int argc)
{
ARDB_CONTEXT = (IntPtr)argv;
var context = new CallContext
{
SteamId = ulong.Parse(Marshal.PtrToStringAnsi((IntPtr)argv[0])),
FileSource = Marshal.PtrToStringAnsi((IntPtr)argv[1]),
MissionName = Marshal.PtrToStringAnsi((IntPtr)argv[2]),
ServerName = Marshal.PtrToStringAnsi((IntPtr)argv[3]),
RemoteExecutedOwner = short.Parse(Marshal.PtrToStringAnsi((IntPtr)argv[4]))
};
STEAMID = context.SteamId.ToString();
if (ARDB_CONTEXTLOG)
{
Log($"Context: SteamID={context.SteamId}, FileSource={context.FileSource}, MissionName={context.MissionName}, ServerName={context.ServerName}, RemoteExecutedOwner={context.RemoteExecutedOwner}", "context");
}
return 100;
}
/// <summary>
/// The entry point for the default "callExtension" command.
/// </summary>
/// <param name="output">A pointer to the output buffer</param>
/// <param name="outputSize">The maximum size of the buffer (20480 bytes)</param>
/// <param name="function">The function identifier passed in "callExtension"</param>
[UnmanagedCallersOnly(EntryPoint = "RVExtension")]
#pragma warning disable IDE0060 // Remove unused parameter
public unsafe static void RVExtension(char* output, int outputSize, char* function)
#pragma warning restore IDE0060 // Remove unused parameter
{
if (!ARDB_INITCHECK)
ARDB_Init();
numCalls++;
var func = GetString(function);
switch (func.ToLower())
{
case "time":
DateTime timeNow = DateTime.Now;
string timeNowString = timeNow.ToString("dd:MM:yyyy HH:mm:ss");
WriteOutput(output, timeNowString);
break;
default:
WriteOutput(output, func);
break;
}
}
/// <summary>
/// The entry point for the "callExtension" command with function arguments.
/// </summary>
/// <param name="output">A pointer to the output buffer</param>
/// <param name="outputSize">The maximum size of the buffer (20480 bytes)</param>
/// <param name="function">The function identifier passed in "callExtension"</param>
/// <param name="argv">The args passed to "callExtension" as a string array</param>
/// <param name="argc">Number of elements in "argv"</param>
/// <returns>The return code</returns>
[UnmanagedCallersOnly(EntryPoint = "RVExtensionArgs")]
public unsafe static int RVExtensionArgs(char* output, int outputSize, char* function, char** argv, int argc)
{
if (!ARDB_INITCHECK)
ARDB_Init();
numCalls++;
var _id = DateTimeOffset.Now.ToUnixTimeMilliseconds();
var func = GetString(function);
List<string> args = Enumerable.Range(0, argc).Select(i => GetString(argv[i])).ToList();
switch (func.ToLower())
{
case "hset":
HandleHashSetOperation(args, argc);
WriteOutput(output, "Async");
return 200;
case "hsetbulk":
HandleHashSetBulkOperation(args, argc);
WriteOutput(output, "Async");
return 200;
case "hget":
HandleHashGetOperation(args, argc);
WriteOutput(output, $"[\"{_id}_hget\",{args[1]}]");
return 100;
case "hgetall":
HandleHashGetAllOperation(args, argc);
WriteOutput(output, $"[\"{_id}_hgetall\",{args[0]}]");
return 100;
case "isloaded":
WriteOutput(output, ARDB_ISLOADED.ToString().ToLower());
return 100;
case "load":
LoadData();
WriteOutput(output, "Data loaded");
return 100;
case "save":
SaveData();
WriteOutput(output, "Data saved");
return 100;
case "version":
WriteOutput(output, ARDB_VERSION);
return 100;
default:
WriteOutput(output, "Available functions: hset, hsetbulk, hget, hgetall, isloaded, load, save, version");
return -1;
}
}
/// <summary>
/// Reads a string from the given pointer.
/// If the pointer is null, a default value will be returned instead.
/// </summary>
/// <param name="pointer">The pointer to read</param>
/// <param name="defaultValue">The string's default value</param>
/// <returns>The marshalled string</returns>
private unsafe static string GetString(char* pointer, string defaultValue = "")
{
return Marshal.PtrToStringAnsi((nint)pointer) ?? defaultValue;
}
/// <summary>
/// Serializes a list of strings into a string representing a valid Arma 3 array.
/// </summary>
/// <param name="list">The list of strings to serialize</param>
/// <returns>A string representing an Arma 3 array</returns>
private static string SerializeList(List<string> list)
{
var content = string.Join(",", [.. list]);
return string.Format("[{0}]", content);
}
/// <summary>
/// Writes the given payload to the output buffer using the provided pointer.
/// Ensures that the payload string is always null terminated.
/// </summary>
/// <param name="output">A pointer to the output buffer</param>
/// <param name="payload">The payload to write</param>
private unsafe static void WriteOutput(char* output, string payload)
{
byte[] bytes = Encoding.ASCII.GetBytes(payload + '\0');
Marshal.Copy(bytes, 0, (nint)output, bytes.Length);
}
private static void SaveData()
{
var db = new RAMDb();
db.ExportToXml();
Log("Data saved to XML", "action");
}
private static void LoadData()
{
var db = new RAMDb();
db.ImportFromXml();
ARDB_ISLOADED = true;
Log("Data loaded from XML", "action");
}
#pragma warning disable IDE0060 // Remove unused parameter
private static void HandleHashSetOperation(List<string> args, int argc)
#pragma warning restore IDE0060 // Remove unused parameter
{
Log($"HashSet: {SerializeList(args)}", "debug");
HashStore.HashSet(STEAMID, args[0], args[1]);
}
#pragma warning disable IDE0060 // Remove unused parameter
private static void HandleHashSetBulkOperation(List<string> args, int argc)
#pragma warning restore IDE0060 // Remove unused parameter
{
var values = new Dictionary<string, string>();
for (int i = 0; i < args.Count; i += 2)
{
string key = args[i];
string value = args[i + 1];
values.Add(key, value);
}
Log($"BulkHashSet: Keys={string.Join(",", values.Keys)}", "debug");
HashStore.HashSetBulk(STEAMID, values);
}
#pragma warning disable IDE0060 // Remove unused parameter
private static void HandleHashGetOperation(List<string> args, int argc)
#pragma warning restore IDE0060 // Remove unused parameter
{
var value = HashStore.HashGet(STEAMID, args[0]);
Log($"HashGet: {SerializeList([value])}", "debug");
Callback("ArmaRAMDb", args[1].Trim('"'), SerializeList([value]));
}
#pragma warning disable IDE0060 // Remove unused parameter
private static void HandleHashGetAllOperation(List<string> args, int argc)
#pragma warning restore IDE0060 // Remove unused parameter
{
var contents = HashStore.HashGetAll(STEAMID);
var list = contents.SelectMany(kv => new[] { kv.Key, kv.Value }).ToList();
Log($"HashGetAll: {SerializeList(list)}", "debug");
Callback("ArmaRAMDb", args[0].Trim('"'), SerializeList(list));
}
}
}

111
extension/src/RAMDb.cs Normal file
View File

@ -0,0 +1,111 @@
using System.Xml.Linq;
using System.Collections.Concurrent;
namespace ArmaRAMDb
{
internal class RAMDb(string path = RAMDb.DEFAULT_STORAGE_PATH) : IDisposable
{
private const string DEFAULT_STORAGE_PATH = "@ramdb\\ArmaRAMDb.xml";
private readonly string _storagePath = Path.Combine(Environment.CurrentDirectory, path);
private XDocument _document;
public static readonly ConcurrentDictionary<string, string> _keyValues = new();
public static readonly ConcurrentDictionary<string, ConcurrentDictionary<string, string>> _hashTables = new();
public static readonly ConcurrentDictionary<string, List<string>> _lists = new();
public void ImportFromXml()
{
if (File.Exists(_storagePath))
{
_document = XDocument.Load(_storagePath);
LoadIntoMemory();
}
}
public void ExportToXml()
{
_document = new XDocument(
new XElement("ArmaRAMDb",
new XElement("KeyValues",
from pair in _keyValues
select new XElement("Entry",
new XAttribute("Key", pair.Key),
new XAttribute("Value", pair.Value))),
new XElement("HashTables",
from table in _hashTables
select new XElement("Table",
new XAttribute("Name", table.Key),
from entry in table.Value
select new XElement("Entry",
new XAttribute("Key", entry.Key),
new XAttribute("Value", entry.Value)))),
new XElement("Lists",
from list in _lists
select new XElement("List",
new XAttribute("Name", list.Key),
from item in list.Value
select new XElement("Item", item)))
));
SaveDocument();
}
private void LoadIntoMemory()
{
Main.Log("Starting XML import", "debug");
foreach (var entry in _document.Root.Element("KeyValues").Elements("Entry"))
{
var key = entry.Attribute("Key").Value;
var value = entry.Attribute("Value").Value;
_keyValues.TryAdd(key, value);
Main.Log($"Loaded key-value: {key} = {value[..Math.Min(50, value.Length)]}...", "debug");
}
foreach (var table in _document.Root.Element("HashTables").Elements("Table"))
{
var tableName = table.Attribute("Name").Value;
Main.Log($"Loading table: {tableName}", "debug");
var concurrentDict = new ConcurrentDictionary<string, string>();
foreach (var entry in table.Elements("Entry"))
{
var key = entry.Attribute("Key").Value;
var value = entry.Attribute("Value").Value;
concurrentDict.TryAdd(key, value);
Main.Log($"Loaded entry: {key} = {value[..Math.Min(50, value.Length)]}...", "debug");
}
_hashTables.TryAdd(tableName, concurrentDict);
}
foreach (var list in _document.Root.Element("Lists").Elements("List"))
{
var listName = list.Attribute("Name").Value;
Main.Log($"Loading list: {listName}", "debug");
var items = new List<string>();
foreach (var item in list.Elements("Item"))
{
var value = item.Value;
items.Add(value);
Main.Log($"Loaded item: {value[..Math.Min(50, value.Length)]}...", "debug");
}
_lists.TryAdd(listName, items);
}
Main.Log("XML import complete", "debug");
}
private void SaveDocument()
{
Directory.CreateDirectory(Path.GetDirectoryName(_storagePath));
_document.Save(_storagePath);
}
public void Dispose()
{
ExportToXml();
}
}
}

BIN
icon_128_ca.paa Normal file

Binary file not shown.

BIN
icon_128_highlight_ca.paa Normal file

Binary file not shown.

BIN
icon_64_ca.paa Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
x\cba\addons\main

View File

@ -0,0 +1,12 @@
#define COMPONENT main
#include "script_mod.hpp"
#ifdef DEBUG_ENABLED_MAIN
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_MAIN
#define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN
#endif
#include "script_macros.hpp"

View File

@ -0,0 +1 @@
#include "script_macros_common.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
#define false 0
#define true 1
#define private 0
#define public 2

View File

@ -0,0 +1,85 @@
#include "\x\cba\addons\main\script_macros_common.hpp"
/*
Header: script_macros_mission.hpp
Description:
Modifies script_common_macros.hpp for compatiblity with missions.
Some addon specific functionality might be lost.
Authors:
Muzzleflash
Changes from script_macros_mission.hpp:
Follows Standard:
Object variables: PREFIX_COMPONENT
Main-object variables: PREFIX_main
Paths: PREFIX\COMPONENT\SCRIPTNAME.sqf
Or if CUSTOM_FOLDER is defined:
CUSTOM_FOLDER\SCRIPTNAME.sqf
eg. six\sys_menu\fDate.sqf
Usage:
Define PREFIX and COMPONENT, then include this file:
#include "\x\cba\addons\main\script_macros_mission.hpp"
*/
/*
CUSTOM_FOLDER
Custom folder to search for files in. Will not change variable names.
Default is PREFIX\COMPONENT
Example:
(begin example)
#define CUSTOM_FOLDER MyPackage\ScriptA
(end)
(begin example)
#define CUSTOM_FOLDER COMPONENT\functions
(end)
*/
#undef PATHTO_SYS
#undef PATHTOF_SYS
#undef PATHTOF2_SYS
#ifdef CUSTOM_FOLDER
#define PATHTO_SYS(var1,var2,var3) ##CUSTOM_FOLDER\##var3.sqf
#define PATHTOF_SYS(var1,var2,var3) ##CUSTOM_FOLDER\##var3
#define PATHTOF2_SYS(var1,var2,var3) ##CUSTOM_FOLDER\##var3
#else
#define PATHTO_SYS(var1,var2,var3) ##var1\##var2\##var3.sqf
#define PATHTOF_SYS(var1,var2,var3) ##var1\##var2\##var3
#define PATHTOF2_SYS(var1,var2,var3) ##var1\##var2\##var3
#endif
/************************** REMOVAL OF MACROS ***********************/
#undef MAINPREFIX
#undef SUBPREFIX
#undef VERSION_AR
#undef VERSION_CONFIG
#undef VERSIONING_SYS
#undef VERSIONING
#undef PRELOAD_ADDONS
#undef BWC_CONFIG
#undef XEH_DISABLED
#undef XEH_PRE_INIT
#undef XEH_PRE_CINIT
#undef XEH_PRE_SINIT
#undef XEH_POST_INIT
#undef XEH_POST_CINIT
#undef XEH_POST_SINIT
#undef PATHTO_FNC
#define PATHTO_FNC(func) class func {\
file = QUOTE(DOUBLES(fnc,func).sqf);\
RECOMPILE;\
}

View File

@ -0,0 +1 @@
x\cba\addons\xeh

View File

@ -0,0 +1,103 @@
#define COMPONENT xeh
#include "\x\cba\addons\main\script_mod.hpp"
//#define DEBUG_ENABLED_XEH
#ifdef DEBUG_ENABLED_XEH
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_XEH
#define DEBUG_SETTINGS DEBUG_SETTINGS_XEH
#endif
#define DEBUG_SYNCHRONOUS
#include "\x\cba\addons\main\script_macros.hpp"
#define XEH_LOG(msg) if (!SLX_XEH_DisableLogging) then { INFO_2("%1 %2",[ARR_3(diag_frameNo,diag_tickTime,time)],msg); }
#define SYS_EVENTHANDLERS(type,class) format [QGVAR(%1:%2), type, class]
#define EVENTHANDLERS(type,class) (missionNamespace getVariable [SYS_EVENTHANDLERS(type,class), []])
#define SETEVENTHANDLERS(type,class,events) (missionNamespace setVariable [SYS_EVENTHANDLERS(type,class), events])
// For any class that does not comply with XEH or has at least one incompatible descendant.
#define ISINCOMP(class) !isNil {GVAR(incompatible) getVariable class}
#define SETINCOMP(class) GVAR(incompatible) setVariable [class, true]
// Event handler variables set.
#define ISPROCESSED(obj) (obj getVariable [QGVAR(isProcessed), false])
#define SETPROCESSED(obj) obj setVariable [QGVAR(isProcessed), true]
// Init and InitPost events done.
#define ISINITIALIZED(obj) (obj getVariable [QGVAR(isInitialized), false])
#define SETINITIALIZED(obj) obj setVariable [QGVAR(isInitialized), true]
#define XEH_FORMAT_CONFIG_NAME(name) format ["Extended_%1_EventHandlers", name]
#define ISKINDOF(object,classname,allowInherit,excluded) ((allowInherit || {typeOf object == classname}) && {{object isKindOf _x} count (excluded) == 0})
#include "script_xeh.hpp"
#undef XEH_ENABLED
#define XEH_ENABLED class EventHandlers {class XEH_CLASS: XEH_CLASS_BASE {};}; SLX_XEH_DISABLED = 0
#define XEH_EVENTS \
"AnimChanged", \
"AnimDone", \
"AnimStateChanged", \
"CargoLoaded", \
"CargoUnloaded", \
"ContainerClosed", \
"ContainerOpened", \
"ControlsShifted", \
"Dammaged", \
"Deleted", \
"Disassembled", \
"Engine", \
"EpeContact", \
"EpeContactEnd", \
"EpeContactStart", \
"Explosion", \
"Fired", \
"FiredBis", \
"FiredMan", \
"FiredNear", \
"Fuel", \
"Gear", \
"GestureChanged", \
"GestureDone", \
"GetIn", \
"GetInMan", \
"GetOut", \
"GetOutMan", \
"Hit", \
"HitPart", \
"IncomingMissile", \
"Init", \
"InitPost", \
"InventoryClosed", \
"InventoryOpened", \
"Killed", \
"LandedTouchDown", \
"LandedStopped", \
"Local", \
"OpticsModeChanged", \
"OpticsSwitch", \
"Put", \
"Reloaded", \
"Respawn", \
"RopeAttach", \
"RopeBreak", \
"SeatSwitched", \
"SeatSwitchedMan", \
"SlotItemChanged", \
"SoundPlayed", \
"Suppressed", \
"Take", \
"TurnIn", \
"TurnOut", \
"VisionModeChanged", \
"WeaponAssembled", \
"WeaponDisassembled", \
"WeaponDeployed", \
"WeaponRested"

View File

@ -0,0 +1,2 @@
// deprecated - use x\CBA\addons\main\script_macros_common.hpp instead
#include "\x\cba\addons\main\script_macros_common.hpp"

View File

@ -0,0 +1,132 @@
/*
Header: script_xeh.hpp
Description:
Used internally.
*/
/////////////////////////////////////////////////////////////////////////////////
// MACRO: EXTENDED_EVENTHANDLERS
// Add all XEH event handlers
/////////////////////////////////////////////////////////////////////////////////
#define EXTENDED_EVENTHANDLERS init = "call cba_xeh_fnc_init"; \
fired = "call cba_xeh_fnc_fired"; \
animChanged = "call cba_xeh_fnc_animChanged"; \
animDone = "call cba_xeh_fnc_animDone"; \
animStateChanged = "call cba_xeh_fnc_animStateChanged"; \
cargoLoaded = "call cba_xeh_fnc_cargoLoaded"; \
cargoUnloaded = "call cba_xeh_fnc_cargoUnloaded"; \
containerClosed = "call cba_xeh_fnc_containerClosed"; \
containerOpened = "call cba_xeh_fnc_containerOpened"; \
controlsShifted = "call cba_xeh_fnc_controlsShifted"; \
dammaged = "call cba_xeh_fnc_dammaged"; \
deleted = "call cba_xeh_fnc_deleted"; \
disassembled = "call cba_xeh_fnc_disassembled"; \
engine = "call cba_xeh_fnc_engine"; \
epeContact = "call cba_xeh_fnc_epeContact"; \
epeContactEnd = "call cba_xeh_fnc_epeContactEnd"; \
epeContactStart = "call cba_xeh_fnc_epeContactStart"; \
explosion = "call cba_xeh_fnc_explosion"; \
firedMan = "call cba_xeh_fnc_firedMan"; \
firedNear = "call cba_xeh_fnc_firedNear"; \
fuel = "call cba_xeh_fnc_cba_xeh_fuel"; \
gear = "call cba_xeh_fnc_gear"; \
gestureChanged = "call cba_xeh_fnc_gestureChanged"; \
gestureDone = "call cba_xeh_fnc_gestureDone"; \
getIn = "call cba_xeh_fnc_getIn"; \
getInMan = "call cba_xeh_fnc_getInMan"; \
getOut = "call cba_xeh_fnc_getOut"; \
getOutMan = "call cba_xeh_fnc_getOutMan"; \
hit = "call cba_xeh_fnc_hit"; \
hitPart = "call cba_xeh_fnc_hitPart"; \
incomingMissile = "call cba_xeh_fnc_incomingMissile"; \
inventoryClosed = "call cba_xeh_fnc_inventoryClosed"; \
inventoryOpened = "call cba_xeh_fnc_inventoryOpened"; \
killed = "call cba_xeh_fnc_killed"; \
landedTouchDown = "call cba_xeh_fnc_landedTouchDown"; \
landedStopped = "call cba_xeh_fnc_landedStopped"; \
local = "call cba_xeh_fnc_local"; \
opticsModeChanged = "call cba_xeh_fnc_opticsModeChanged"; \
opticsSwitch = "call cba_xeh_fnc_opticsSwitch"; \
put = "call cba_xeh_fnc_put"; \
reloaded = "call cba_xeh_fnc_reloaded"; \
respawn = "call cba_xeh_fnc_respawn"; \
ropeAttach = "call cba_xeh_fnc_ropeAttach"; \
ropeBreak = "call cba_xeh_fnc_ropeBreak"; \
seatSwitched = "call cba_xeh_fnc_seatSwitched"; \
seatSwitchedMan = "call cba_xeh_fnc_seatSwitchedMan"; \
slotItemChanged = "call cba_xeh_fnc_slotItemChanged"; \
suppressed = "call cba_xeh_fnc_suppressed"; \
soundPlayed = "call cba_xeh_fnc_soundPlayed"; \
take = "call cba_xeh_fnc_take"; \
turnIn = "call cba_xeh_fnc_turnIn"; \
turnOut = "call cba_xeh_fnc_turnOut"; \
visionModeChanged = "call cba_xeh_fnc_visionModeChanged"; \
weaponAssembled = "call cba_xeh_fnc_weaponAssembled"; \
weaponDisassembled = "call cba_xeh_fnc_weaponDisassembled"; \
weaponDeployed = "call cba_xeh_fnc_weaponDeployed"; \
weaponRested = "call cba_xeh_fnc_weaponRested";
/*
MACRO: DELETE_EVENTHANDLERS
Removes all event handlers.
*/
#define DELETE_EVENTHANDLERS init = ""; \
fired = ""; \
animChanged = ""; \
animDone = ""; \
animStateChanged = ""; \
cargoLoaded = ""; \
cargoUnloaded = ""; \
containerClosed = ""; \
containerOpened = ""; \
controlsShifted = ""; \
dammaged = ""; \
deleted = ""; \
disassembled = ""; \
engine = ""; \
epeContact = ""; \
epeContactEnd = ""; \
epeContactStart = ""; \
explosion = ""; \
firedMan = ""; \
firedNear = ""; \
fuel = ""; \
gear = ""; \
gestureChanged = ""; \
gestureDone = "" \
getIn = ""; \
getInMan = ""; \
getOut = ""; \
getOutMan = ""; \
hit = ""; \
hitPart = ""; \
incomingMissile = ""; \
inventoryClosed = ""; \
inventoryOpened = ""; \
killed = ""; \
landedTouchDown = ""; \
landedStopped = ""; \
local = ""; \
opticsModeChanged = ""; \
opticsSwitch = ""; \
put = ""; \
reloaded = ""; \
respawn = ""; \
ropeAttach = ""; \
ropeBreak = ""; \
seatSwitched = ""; \
seatSwitchedMan = ""; \
soundPlayed = ""; \
suppressed = ""; \
take = ""; \
turnIn = ""; \
turnOut = ""; \
visionModeChanged = ""; \
weaponAssembled = ""; \
weaponDisassembled = ""; \
weaponDeployed = ""; \
weaponRested = "";

View File

@ -0,0 +1 @@
z\ace\addons\common

View File

@ -0,0 +1,32 @@
#define COMPONENT common
#define COMPONENT_BEAUTIFIED Common
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_COMMON
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_COMMON
#define DEBUG_SETTINGS DEBUG_SETTINGS_COMMON
#endif
#include "\z\ace\addons\main\script_macros.hpp"
// just kept for BWC, canDig now uses GVAR(canDigSurfaces)
#define DIG_SURFACE_BLACKLIST [ \
"concrete", "concrete_exp", "concrete_int", "int_concrete", "int_concrete_exp", \
"pavement_exp", "int_pavement_exp", \
"tiling", "tiles_int", "int_tiles", \
"roof_tin", "roof_tiles", "rooftiles_exp", \
"tarmac", "asphalt_exp", \
"stones_exp", "rock", "stony", \
"metal", "gridmetal_exp", "metalplate_exp", "int_metalplate_exp", "metal_int", "wavymetal", "wavymetal_exp", "int_metal", "steel_exp", \
"lino_exp", "int_lino_exp", "int_mat_exp", \
"wood", "wood_int", "int_wood", "softwood_exp", "int_softwood_exp", "int_solidwood_exp" \
]
#define DIG_SURFACE_WHITELIST ["grass", "grasstall_exp", "forest_exp", "snow"]

View File

@ -0,0 +1 @@
z\ace\addons\main

View File

@ -0,0 +1,17 @@
#define COMPONENT main
#define COMPONENT_BEAUTIFIED Main
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_MAIN
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_MAIN
#define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -0,0 +1,58 @@
/**
Fast Recompiling via function
**/
// #define DISABLE_COMPILE_CACHE
// To Use: [] call ACE_PREP_RECOMPILE;
#ifdef DISABLE_COMPILE_CACHE
#define LINKFUNC(x) {_this call FUNC(x)}
#define PREP_RECOMPILE_START if (isNil "ACE_PREP_RECOMPILE") then {ACE_RECOMPILES = []; ACE_PREP_RECOMPILE = {{call _x} forEach ACE_RECOMPILES;}}; private _recomp = {
#define PREP_RECOMPILE_END }; call _recomp; ACE_RECOMPILES pushBack _recomp;
#else
#define LINKFUNC(x) FUNC(x)
#define PREP_RECOMPILE_START ; /* disabled */
#define PREP_RECOMPILE_END ; /* disabled */
#endif
/**
STACK TRACING
**/
//#define ENABLE_CALLSTACK
//#define ENABLE_PERFORMANCE_COUNTERS
//#define DEBUG_EVENTS
#ifdef ENABLE_CALLSTACK
#define CALLSTACK(function) {if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'ANON', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'ANON'; private _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define CALLSTACK_NAMED(function, functionName) {if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, functionName, _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = functionName; private _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define DUMPSTACK ([__FILE__, __LINE__] call ACE_DUMPSTACK_FNC)
#define FUNC(var1) {if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(ADDON,fnc,var1)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(ADDON,fnc,var1)'; private _ret = _this call TRIPLES(ADDON,fnc,var1); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define EFUNC(var1,var2) {if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)'; private _ret = _this call TRIPLES(DOUBLES(PREFIX,var1),fnc,var2); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#else
#define CALLSTACK(function) function
#define CALLSTACK_NAMED(function, functionName) function
#define DUMPSTACK ; /* disabled */
#endif
/**
PERFORMANCE COUNTERS SECTION
**/
//#define ENABLE_PERFORMANCE_COUNTERS
// To Use: [] call ace_common_fnc_dumpPerformanceCounters;
#ifdef ENABLE_PERFORMANCE_COUNTERS
#define CBA_fnc_addPerFrameHandler { _ret = [(_this select 0), (_this select 1), (_this select 2), #function] call CBA_fnc_addPerFrameHandler; if(isNil "ACE_PFH_COUNTER" ) then { ACE_PFH_COUNTER=[]; }; ACE_PFH_COUNTER pushBack [[_ret, __FILE__, __LINE__], [(_this select 0), (_this select 1), (_this select 2)]]; _ret }
#define CREATE_COUNTER(x) if(isNil "ACE_COUNTERS" ) then { ACE_COUNTERS=[]; }; GVAR(DOUBLES(x,counter))=[]; GVAR(DOUBLES(x,counter)) set[0, QUOTE(GVAR(DOUBLES(x,counter)))]; GVAR(DOUBLES(x,counter)) set[1, diag_tickTime]; ACE_COUNTERS pushBack GVAR(DOUBLES(x,counter));
#define BEGIN_COUNTER(x) if(isNil QUOTE(GVAR(DOUBLES(x,counter)))) then { CREATE_COUNTER(x) }; GVAR(DOUBLES(x,counter)) set[2, diag_tickTime];
#define END_COUNTER(x) GVAR(DOUBLES(x,counter)) pushBack [(GVAR(DOUBLES(x,counter)) select 2), diag_tickTime];
#define DUMP_COUNTERS ([__FILE__, __LINE__] call ACE_DUMPCOUNTERS_FNC)
#else
#define CREATE_COUNTER(x) ; /* disabled */
#define BEGIN_COUNTER(x) ; /* disabled */
#define END_COUNTER(x) ; /* disabled */
#define DUMP_COUNTERS ; /* disabled */
#endif

View File

@ -0,0 +1,179 @@
#define DEBUG_SYNCHRONOUS
#include "\x\cba\addons\main\script_macros_common.hpp"
#include "\x\cba\addons\xeh\script_xeh.hpp"
// Default versioning level
#define DEFAULT_VERSIONING_LEVEL 2
#define DGVAR(varName) if(isNil "ACE_DEBUG_NAMESPACE") then { ACE_DEBUG_NAMESPACE = []; }; if(!(QUOTE(GVAR(varName)) in ACE_DEBUG_NAMESPACE)) then { PUSH(ACE_DEBUG_NAMESPACE, QUOTE(GVAR(varName))); }; GVAR(varName)
#define DVAR(varName) if(isNil "ACE_DEBUG_NAMESPACE") then { ACE_DEBUG_NAMESPACE = []; }; if(!(QUOTE(varName) in ACE_DEBUG_NAMESPACE)) then { PUSH(ACE_DEBUG_NAMESPACE, QUOTE(varName)); }; varName
#define DFUNC(var1) TRIPLES(ADDON,fnc,var1)
#define DEFUNC(var1,var2) TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)
#undef QFUNC
#undef QEFUNC
#define QFUNC(var1) QUOTE(DFUNC(var1))
#define QEFUNC(var1,var2) QUOTE(DEFUNC(var1,var2))
#define GETVAR_SYS(var1,var2) getVariable [ARR_2(QUOTE(var1),var2)]
#define SETVAR_SYS(var1,var2) setVariable [ARR_2(QUOTE(var1),var2)]
#define SETPVAR_SYS(var1,var2) setVariable [ARR_3(QUOTE(var1),var2,true)]
#undef GETVAR
#define GETVAR(var1,var2,var3) (var1 GETVAR_SYS(var2,var3))
#define GETMVAR(var1,var2) (missionNamespace GETVAR_SYS(var1,var2))
#define GETUVAR(var1,var2) (uiNamespace GETVAR_SYS(var1,var2))
#define GETPRVAR(var1,var2) (profileNamespace GETVAR_SYS(var1,var2))
#define GETPAVAR(var1,var2) (parsingNamespace GETVAR_SYS(var1,var2))
#undef SETVAR
#define SETVAR(var1,var2,var3) var1 SETVAR_SYS(var2,var3)
#define SETPVAR(var1,var2,var3) var1 SETPVAR_SYS(var2,var3)
#define SETMVAR(var1,var2) missionNamespace SETVAR_SYS(var1,var2)
#define SETUVAR(var1,var2) uiNamespace SETVAR_SYS(var1,var2)
#define SETPRVAR(var1,var2) profileNamespace SETVAR_SYS(var1,var2)
#define SETPAVAR(var1,var2) parsingNamespace SETVAR_SYS(var1,var2)
#define GETGVAR(var1,var2) GETMVAR(GVAR(var1),var2)
#define GETEGVAR(var1,var2,var3) GETMVAR(EGVAR(var1,var2),var3)
#define ARR_SELECT(ARRAY,INDEX,DEFAULT) (if (count ARRAY > INDEX) then {ARRAY select INDEX} else {DEFAULT})
#define ANY_OF(ARRAY,CONDITION) (ARRAY findIf {CONDITION} != -1)
// ACEX Merge
#define ACEX_PREFIX acex
#define XADDON DOUBLES(ACEX_PREFIX,COMPONENT)
#define XGVAR(var) DOUBLES(XADDON,var)
#define EXGVAR(var1,var2) TRIPLES(ACEX_PREFIX,var1,var2)
#define QXGVAR(var) QUOTE(XGVAR(var))
#define QEXGVAR(var1,var2) QUOTE(EXGVAR(var1,var2))
#define QQXGVAR(var) QUOTE(QXGVAR(var))
#define QQEXGVAR(var1,var2) QUOTE(QEXGVAR(var1,var2))
#define ACEX_PREP(func) PREP(func); TRIPLES(XADDON,fnc,func) = DFUNC(func)
#define MACRO_ADDWEAPON(WEAPON,COUNT) class _xx_##WEAPON { \
weapon = #WEAPON; \
count = COUNT; \
}
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
}
#define MACRO_ADDMAGAZINE(MAGAZINE,COUNT) class _xx_##MAGAZINE { \
magazine = #MAGAZINE; \
count = COUNT; \
}
#define MACRO_ADDBACKPACK(BACKPACK,COUNT) class _xx_##BACKPACK { \
backpack = #BACKPACK; \
count = COUNT; \
}
// weapon types
#define TYPE_WEAPON_PRIMARY 1
#define TYPE_WEAPON_HANDGUN 2
#define TYPE_WEAPON_SECONDARY 4
// magazine types
#define TYPE_MAGAZINE_HANDGUN_AND_GL 16 // mainly
#define TYPE_MAGAZINE_PRIMARY_AND_THROW 256
#define TYPE_MAGAZINE_SECONDARY_AND_PUT 512 // mainly
#define TYPE_MAGAZINE_MISSILE 768
// more types
#define TYPE_BINOCULAR_AND_NVG 4096
#define TYPE_WEAPON_VEHICLE 65536
#define TYPE_ITEM 131072
// item types
#define TYPE_DEFAULT 0
#define TYPE_MUZZLE 101
#define TYPE_OPTICS 201
#define TYPE_FLASHLIGHT 301
#define TYPE_BIPOD 302
#define TYPE_FIRST_AID_KIT 401
#define TYPE_FINS 501 // not implemented
#define TYPE_BREATHING_BOMB 601 // not implemented
#define TYPE_NVG 602
#define TYPE_GOGGLE 603
#define TYPE_SCUBA 604 // not implemented
#define TYPE_HEADGEAR 605
#define TYPE_FACTOR 607
#define TYPE_MAP 608
#define TYPE_COMPASS 609
#define TYPE_WATCH 610
#define TYPE_RADIO 611
#define TYPE_GPS 612
#define TYPE_HMD 616
#define TYPE_BINOCULAR 617
#define TYPE_MEDIKIT 619
#define TYPE_TOOLKIT 620
#define TYPE_UAV_TERMINAL 621
#define TYPE_VEST 701
#define TYPE_UNIFORM 801
#define TYPE_BACKPACK 901
#ifdef DISABLE_COMPILE_CACHE
#undef PREP
#define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QPATHTOF(functions\DOUBLES(fnc,fncName).sqf)
#else
#undef PREP
#define PREP(fncName) [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf), QFUNC(fncName)] call CBA_fnc_compileFunction
#endif
#define PREP_MODULE(folder) [] call compile preprocessFileLineNumbers QPATHTOF(folder\__PREP__.sqf)
#define ACE_isHC (!hasInterface && !isDedicated)
#define IDC_STAMINA_BAR 193
#define ACE_DEPRECATED(arg1,arg2,arg3) WARNING_3("%1 is deprecated. Support will be dropped in version %2. Replaced by: %3",arg1,arg2,arg3)
#define PFORMAT_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) \
format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9, I=%10 J=%11', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H), RETNIL(I), RETNIL(J)]
#ifdef DEBUG_MODE_FULL
#define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) LOG_SYS_FILELINENUMBERS('TRACE',PFORMAT_10(str diag_frameNo + ' ' + (MESSAGE),A,B,C,D,E,F,G,H,I,J))
#else
#define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) /* disabled */
#endif
#define GRAVITY 9.8066
#define SD_TO_MIN_MAX(d) ((d) * 3.371) // Standard deviation -> min / max of random [min, mid, max]
// Angular unit conversion
// Conversion factor: 54 / (5 * PI)
#define MRAD_TO_MOA(d) ((d) * 3.43774677)
// Conversion factor: (5 * PI) / 54
#define MOA_TO_MRAD(d) ((d) * 0.29088821)
// Conversion factor: 60
#define DEG_TO_MOA(d) ((d) * 60)
// Conversion factor: 1 / 60
#define MOA_TO_DEG(d) ((d) / 60)
// Conversion factor: (50 * PI) / 9
#define DEG_TO_MRAD(d) ((d) * 17.45329252)
// Conversion factor: 9 / (50 * PI)
#define MRAD_TO_DEG(d) ((d) / 17.45329252)
// Conversion factor: PI / 10800
#define MOA_TO_RAD(d) ((d) * 0.00029088)
#define ZEUS_ACTION_CONDITION ([_target, {QUOTE(QUOTE(ADDON)) in curatorAddons _this}, missionNamespace, QUOTE(QGVAR(zeusCheck)), 1E11, 'ace_interactMenuClosed'] call EFUNC(common,cachedCall))
#define SUBSKILLS ["aimingAccuracy", "aimingShake", "aimingSpeed", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general"]
// macro add a dummy cfgPatch and notLoaded entry
#define ACE_PATCH_NOT_LOADED(NAME,CAUSE) \
class CfgPatches { \
class DOUBLES(NAME,notLoaded) { \
units[] = {}; \
weapons[] = {}; \
requiredVersion = REQUIRED_VERSION; \
requiredAddons[] = {"ace_main"}; \
VERSION_CONFIG; \
}; \
}; \
class ace_notLoaded { \
NAME = CAUSE; \
};
#include "script_debug.hpp"

View File

@ -0,0 +1,23 @@
// COMPONENT should be defined in the script_component.hpp and included BEFORE this hpp
#define MAINPREFIX z
#define PREFIX ace
#include "script_version.hpp"
#define VERSION MAJOR.MINOR
#define VERSION_STR MAJOR.MINOR.PATCHLVL.BUILD
#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD
// MINIMAL required version for the Mod. Components can specify others..
#define REQUIRED_VERSION 2.18
#define REQUIRED_CBA_VERSION {3,18,0}
#ifndef COMPONENT_BEAUTIFIED
#define COMPONENT_BEAUTIFIED COMPONENT
#endif
#ifdef SUBCOMPONENT_BEAUTIFIED
#define COMPONENT_NAME QUOTE(ACE3 - COMPONENT_BEAUTIFIED - SUBCOMPONENT_BEAUTIFIED)
#else
#define COMPONENT_NAME QUOTE(ACE3 - COMPONENT_BEAUTIFIED)
#endif

View File

@ -0,0 +1,4 @@
#define MAJOR 3
#define MINOR 18
#define PATCHLVL 1
#define BUILD 91

91
main.go Normal file
View File

@ -0,0 +1,91 @@
package main
import (
"encoding/json"
"fmt"
"log"
"os"
"path/filepath"
"code.gitea.io/sdk/gitea"
)
type VersionInfo struct {
Version string `json:"version"`
}
func main() {
client, err := createGiteaClient()
if err != nil {
log.Fatalf("Error creating Gitea client: %v", err)
}
version := os.Getenv("VERSION")
if version == "" {
log.Fatalf("VERSION environment variable is not set")
}
if err := updateVersionFile(version); err != nil {
log.Fatalf("Error updating version file: %v", err)
}
repoOwner := "IDSolutions"
repoName := "ramdb"
release, err := createRelease(client, repoOwner, repoName, version)
if err != nil {
log.Fatalf("Error creating release: %v", err)
}
artifactFilename := fmt.Sprintf("ramdb-%s.zip", version)
artifactPath := filepath.Join("releases", artifactFilename)
if err := uploadArtifact(client, repoOwner, repoName, release.ID, artifactPath); err != nil {
log.Fatalf("Error uploading release asset: %v", err)
}
fmt.Println("Release created, artifact uploaded, and version file updated successfully!")
}
func updateVersionFile(version string) error {
versionInfo := VersionInfo{Version: version}
jsonData, err := json.MarshalIndent(versionInfo, "", " ")
if err != nil {
return fmt.Errorf("error marshaling version info: %w", err)
}
err = os.WriteFile("ramdb_version.json", jsonData, 0644)
if err != nil {
return fmt.Errorf("error writing version file: %w", err)
}
return nil
}
func createGiteaClient() (*gitea.Client, error) {
token := os.Getenv("GITHUB_TOKEN")
if token == "" {
return nil, fmt.Errorf("GITHUB_TOKEN environment variable is not set")
}
return gitea.NewClient("https://gitea.innovativedevsolutions.org", gitea.SetToken(token))
}
func createRelease(client *gitea.Client, owner, repo, version string) (*gitea.Release, error) {
release, _, err := client.CreateRelease(owner, repo, gitea.CreateReleaseOption{
TagName: version,
Title: fmt.Sprintf("ArmaRAMDb v%s", version),
Note: fmt.Sprintf("Release notes for version %s", version),
})
return release, err
}
func uploadArtifact(client *gitea.Client, owner, repo string, releaseID int64, artifactPath string) error {
file, err := os.Open(artifactPath)
if err != nil {
return fmt.Errorf("error opening artifact file: %w", err)
}
defer file.Close()
_, _, err = client.CreateReleaseAttachment(owner, repo, releaseID, file, filepath.Base(artifactPath))
return err
}

12
mod.cpp Normal file
View File

@ -0,0 +1,12 @@
name = "ArmaRAMDb";
author = "IDSolutions";
picture = "title_co.paa";
logoSmall = "icon_64_ca.paa";
logo = "icon_128_ca.paa";
logoOver = "icon_128_highlight_ca.paa";
tooltip = "ArmaRAMDb";
tooltipOwned = "ArmaRAMDb";
overview = "IDSolutions ArmaRAMDb - Official Modification";
description = "IDS Dragonfly - Version 1.0.0";
action = "https://gitea.innovativedevsolutions.org/IDSolutions/ramdb";
actionName = "Website";

3
ramdb_version.json Normal file
View File

@ -0,0 +1,3 @@
{
"version": "1.0.0"
}

BIN
title_co.paa Normal file

Binary file not shown.

187
tools/sqf_validator.py Normal file
View File

@ -0,0 +1,187 @@
#!/usr/bin/env python3
import fnmatch
import os
import re
import sys
def valid_keyword_after_code(content, index):
for word in ["for", "do", "count", "each", "forEach", "else", "and", "not", "isEqualTo", "isNotEqualTo", "in", "call", "spawn", "execVM", "catch", "param", "select", "apply", "findIf", "remoteExec"]:
if content.find(word, index, index + len(word)) != -1:
return True
return False
def check_sqf(filepath):
errors = []
with open(filepath, "r", encoding = "utf-8", errors = "ignore") as file:
content = file.read()
# Store all brackets we find in this file, so we can validate everything on the end
brackets = []
# Used in case we are in a line comment (//)
ignore_till_eol = False
# To check if we are in a comment block
in_comment_block = False
check_if_comment = False
# Used in case we are in a comment block (/* */)
# This is true if we detect a * inside a comment block
# If the next character is a /, it means we end our comment block
check_if_closing = False
# We ignore everything inside a string
in_string = False
# Used to store the starting type of a string, so we can match that to the end of a string
string_type = ""
# Used to check for semicolon after code blocks
last_is_curly_brace = False
check_for_semicolon = False
# Extra information so we know what line we find errors at
line_number = 1
char_index = 0
for c in content:
if last_is_curly_brace:
last_is_curly_brace = False
# Test generates false positives with binary commands that take CODE as 2nd arg (e.g. findIf)
check_for_semicolon = not re.search("findIf", content, re.IGNORECASE)
# Keep track of current line number
if c == "\n":
line_number += 1
# While we are in a string, we can ignore everything else, except the end of the string
if in_string:
if c == string_type:
in_string = False
# Look for the end of this comment block
elif in_comment_block:
if c == "*":
check_if_closing = True
elif check_if_closing:
if c == "/":
in_comment_block = False
elif c != "*":
check_if_closing = False
# If we are not in a comment block, we will check if we are at the start of one or count the () {} and []
else:
# This means we have encountered a /, so we are now checking if this is an inline comment or a comment block
if check_if_comment:
check_if_comment = False
# If the next character after / is a *, we are at the start of a comment block
if c == "*":
in_comment_block = True
# Otherwise, check if we are in an line comment, / followed by another / (//)
elif c == "/":
ignore_till_eol = True
if not in_comment_block:
if ignore_till_eol:
# We are in a line comment, just continue going through the characters until we find an end of line
if c == "\n":
ignore_till_eol = False
else:
if c == '"' or c == "'":
in_string = True
string_type = c
elif c == "/":
check_if_comment = True
elif c == "\t":
errors.append(" ERROR: Found a tab on line {}.".format(line_number))
elif c in ["(", "[", "{"]:
brackets.append(c)
elif c == ")":
if not brackets or brackets[-1] in ["[", "{"]:
errors.append(" ERROR: Missing parenthesis '(' on line {}.".format(line_number))
brackets.append(c)
elif c == "]":
if not brackets or brackets[-1] in ["(", "{"]:
errors.append(" ERROR: Missing square bracket '[' on line {}.".format(line_number))
brackets.append(c)
elif c == "}":
last_is_curly_brace = True
if not brackets or brackets[-1] in ["(", "["]:
errors.append(" ERROR: Missing curly brace '{{' on line {}.".format(line_number))
brackets.append(c)
if check_for_semicolon:
# Keep reading until no white space or comments
if c not in [" ", "\t", "\n", "/"]:
check_for_semicolon = False
if c not in ["]", ")", "}", ";", ",", "&", "!", "|", "="] and not valid_keyword_after_code(content, char_index):
errors.append(" ERROR: Possible missing semicolon ';' on line {}.".format(line_number))
char_index += 1
# Compare opening and closing bracket counts
if brackets.count("(") != brackets.count(")"):
errors.append(" ERROR: Unequal number of parentheses, '(' = {}, ')' = {}.".format(brackets.count("("), brackets.count(")")))
if brackets.count("[") != brackets.count("]"):
errors.append(" ERROR: Unequal number of square brackets, '[' = {}, ']' = {}.".format(brackets.count("["), brackets.count("]")))
if brackets.count("{") != brackets.count("}"):
errors.append(" ERROR: Unequal number of curly braces, '{{' = {}, '}}' = {}.".format(brackets.count("{"), brackets.count("}")))
# Ensure includes are before block comments
if re.compile('\s*(/\*[\s\S]+?\*/)\s*#include').match(content):
errors.append(" ERROR: Found an #include after a block comment.")
return errors
def main():
print("Validating SQF")
print("--------------")
# Allow running from root directory and tools directory
root_dir = ".."
if os.path.exists("addons"):
root_dir = "."
# Check all SQF files in the project directory
sqf_files = []
for root, _, files in os.walk(root_dir):
for file in fnmatch.filter(files, "*.sqf"):
sqf_files.append(os.path.join(root, file))
sqf_files.sort()
bad_count = 0
for filepath in sqf_files:
errors = check_sqf(filepath)
if errors:
print("\nFound {} error(s) in {}:".format(len(errors), os.path.relpath(filepath, root_dir)))
for error in errors:
print(error)
bad_count += 1
print("\nChecked {} files, found errors in {}.".format(len(sqf_files), bad_count))
if bad_count == 0:
print("SQF Validation PASSED")
else:
print("SQF Validation FAILED")
return bad_count
if __name__ == "__main__":
sys.exit(main())

146
tools/version_bumper.py Normal file
View File

@ -0,0 +1,146 @@
# Based on Arma 3 make.py
# https://github.com/acemod/arma-project-template/blob/master/tools/make.py
__version__ = "0.1"
import re
import subprocess
import sys
import os
# Check Python version
if sys.version_info[0] != 3:
print("Python 3 is required.")
sys.exit(1)
# Globals
push_commit = False
framework_version = "0.0.0.0"
def bump_version(version_increments=[]):
if not version_increments:
print("No increment was given. Please provide one of the following:")
print("'increment_major', 'increment_minor', 'increment_patch', 'increment_build'")
sys.exit(1)
global framework_version
version_stamp = framework_version
try:
from pathlib import Path
script_path = Path(__file__).parents[1]
script_version_path = os.path.join(script_path, "addons/main/script_version.hpp")
if os.path.isfile(script_version_path):
file = open(script_version_path, "r")
hpp_text = file.read()
file.close()
if hpp_text:
major_text = re.search(r"#define MAJOR (.*\b)", hpp_text).group(1)
minor_text = re.search(r"#define MINOR (.*\b)", hpp_text).group(1)
patch_text = re.search(r"#define PATCH (.*\b)", hpp_text).group(1)
build_text = re.search(r"#define BUILD (.*\b)", hpp_text).group(1)
print("Current version: {}.{}.{}.{}".format(major_text, minor_text, patch_text, build_text))
if version_increments:
if "major" in version_increments:
major_text = int(major_text) + 1
minor_text = 0
patch_text = 0
elif "minor" in version_increments:
minor_text = int(minor_text) + 1
patch_text = 0
elif "patch" in version_increments:
patch_text = int(patch_text) + 1
# Always increment build
build_text = int(build_text) + 1
version_stamp = "{}.{}.{}.{}".format(major_text, minor_text, patch_text, build_text)
print("Incrementing version to {}".format(version_stamp))
with open(script_version_path, "w", newline="\n") as file:
file.writelines([
"#define MAJOR {}\n".format(major_text),
"#define MINOR {}\n".format(minor_text),
"#define PATCH {}\n".format(patch_text),
"#define BUILD {}\n".format(build_text)
])
else:
print("Version file is missing or cannot be accessed.")
sys.exit(1)
except Exception as e:
print("Error in get_version(): {}".format(e))
print("Check the integrity of the file: {}".format(script_version_path))
print("Resetting to the default version stamp: {}".format(version_stamp))
sys.exit(1)
framework_version = version_stamp
# Set environment variable
subprocess.call("echo '::set-output name=VERSION::{}'".format(framework_version), shell=True)
git_push()
def git_push():
if not push_commit:
print("Skipping pushing commit...")
return
print("Pushing to remote...")
# Set up credentials
subprocess.call(["git", "config", "--local", "user.name", "github-actions"])
subprocess.call(["git", "config", "--local", "user.email", "actions@no-reply.github.com"])
# Push commit
commit_msg = "v" + ".".join(framework_version.split(".")[0:3]) + " Build " + framework_version.split(".")[3]
subprocess.call(["git", "add", "-A"])
subprocess.call(["git", "commit", "-m", commit_msg])
subprocess.call(["git", "push", "origin", "master"])
print("Pushed commit to master: {}".format(commit_msg))
def main(argv):
print("This is version_bumper.py for MalFramework, based on the original make.py script by Ryan Schultz.")
global push_commit
global framework_version
# Which part of the version should be incremented
version_increments = []
if "increment_build" in argv:
argv.remove("increment_build")
version_increments.append("build")
if "increment_patch" in argv:
argv.remove("increment_patch")
version_increments.append("patch")
if "increment_minor" in argv:
argv.remove("increment_minor")
version_increments.append("minor")
if "increment_major" in argv:
argv.remove("increment_major")
version_increments.append("major")
# Should push a commit to master
if "push_commit" in argv:
argv.remove("push_commit")
push_commit = True
bump_version(version_increments)
if __name__ == "__main__":
main(sys.argv)
print("Building successful.")
sys.exit(0)

2
unlocks.txt Normal file
View File

@ -0,0 +1,2 @@
[["SOG_Phone", "SOG_Tablet", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch", "U_BG_Guerrilla_6_1", "V_Rangemaster_belt"],["hgun_P07_F"],["16Rnd_9x21_Mag"],[]]
[["B_Quadbike_01_F"],[],[],[],[],[]]