Skip to content

Commit

Permalink
Move the directb2sReelSoundsONOFF.cmd over from B2S.Server
Browse files Browse the repository at this point in the history
Update the README.md for the designer
Add the workflow from jsm174 back here
Added CODE_OF_CONDUCT.md CONTRIBUTING.md
  • Loading branch information
JockeJarre committed Oct 21, 2023
1 parent 8082fdc commit 5f87af7
Show file tree
Hide file tree
Showing 9 changed files with 527 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/b2s-backglass.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: b2s-backglass
on:
push:

defaults:
run:
shell: bash

jobs:
build-designer:
name: Build B2SBackglassDesigner-${{ matrix.config }}-win-${{ matrix.platform }}
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
include:
- platform: x86
config: Debug
- platform: x86
config: Release
steps:
- uses: actions/checkout@v3
- id: version
name: Update AssemblyInformationalVersion
run: |
SHA7="${GITHUB_SHA::7}"
ASSEMBLY_INFO="B2SVPinMAMEStarter/AssemblyInfo.vb"
VERSION=$(grep -Eo "AssemblyVersion\(.*\)" "${ASSEMBLY_INFO}" | grep -Eo "[0-9\.]+" | tail -1)
TAG="${VERSION}-${SHA7}"
perl -i -pe"s/AssemblyInformationalVersion\(\".*\"\)/AssemblyInformationalVersion\(\"${TAG}\"\)/g" "${ASSEMBLY_INFO}"
ASSEMBLY_INFO="b2sbackglassdesigner/b2sbackglassdesigner/My Project/AssemblyInfo.vb"
VERSION=$(grep -Eo "AssemblyVersion\(.*\)" "${ASSEMBLY_INFO}" | grep -Eo "[0-9\.]+" | tail -1)
TAG="${VERSION}-${SHA7}"
perl -i -pe"s/AssemblyInformationalVersion\(\".*\"\)/AssemblyInformationalVersion\(\"${TAG}\"\)/g" "${ASSEMBLY_INFO}"
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- uses: microsoft/setup-msbuild@v1.1
- name: Build
run: |
msbuild B2SVPinMAMEStarter/B2SVPinMAMEStarter.sln /t:Rebuild /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.platform }}
msbuild b2sbackglassdesigner/B2SBackglassDesigner.sln /t:Rebuild /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.platform }}
shell: cmd
- name: Help
run: |
choco install html-help-workshop
"/c/Program Files (x86)/HTML Help Workshop/hhc.exe" "b2sbackglassdesigner/b2sbackglassdesigner/htmlhelp/B2SBackglassDesigner.hhp" || true
- name: Bundle
run: |
mkdir tmp
cp B2SVPinMAMEStarter/bin/${{ matrix.platform }}/${{ matrix.config }}/B2SVPinMAMEStarter.exe tmp
cp b2sbackglassdesigner/b2sbackglassdesigner/bin/${{ matrix.platform }}/${{ matrix.config }}/B2SBackglassDesigner.exe tmp
if [[ "${{ matrix.config }}" == "Debug" ]]; then
cp B2SVPinMAMEStarter/bin/${{ matrix.platform }}/${{ matrix.config }}/B2SVPinMAMEStarter.pdb tmp
cp b2sbackglassdesigner/b2sbackglassdesigner/bin/${{ matrix.platform }}/${{ matrix.config }}/B2SBackglassDesigner.pdb tmp
fi
cp b2sbackglassdesigner/b2sbackglassdesigner/htmlhelp/B2SBackglassDesigner.chm tmp
cp license.txt tmp
- uses: actions/upload-artifact@v3
with:
name: B2SBackglassDesigner-${{ steps.version.outputs.tag }}-${{ matrix.config }}-win-${{ matrix.platform }}
path: tmp
51 changes: 51 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: prerelease
on:
workflow_dispatch:
inputs:
sha:
description: "SHA (leave blank for HEAD)"
required: false

env:
ACTIONS_API_URL: https://api.github.com/repos/${GITHUB_REPOSITORY}/actions

jobs:
version:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.sha.outputs.sha }}
sha7: ${{ steps.sha.outputs.sha7 }}
steps:
- id: sha
run: |
SHA=$(if [[ "${{ github.event.inputs.sha }}" ]]; then echo "${{ github.event.inputs.sha }}"; else echo "${GITHUB_SHA}"; fi)
SHA7="${SHA::7}"
echo "sha=${SHA}" >> $GITHUB_OUTPUT
echo "sha7=${SHA7}" >> $GITHUB_OUTPUT
prerelease:
runs-on: ubuntu-latest
needs: [ version ]
steps:
- id: download
run: |
curl -s "${{ env.ACTIONS_API_URL }}/runs" --output runs.json
RUN_ID=$(jq -r --arg SHA "${{ needs.version.outputs.sha }}" --arg NAME "b2s-designer" '.workflow_runs[] | select(.head_sha==$SHA and .name==$NAME) | .id' runs.json)
echo "Downloading b2s-designer artifact list ${RUN_ID}..."
curl -s "${{ env.ACTIONS_API_URL }}/runs/${RUN_ID}/artifacts" --output artifacts.json
ARTIFACTS=($(jq -r '.artifacts[] | .archive_download_url' artifacts.json))
for url in ${ARTIFACTS[@]}
do
echo "Downloading artifact: ${url}..."
curl -s -OJ -L -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" ${url}
done
rm *.json
- id: create_release
uses: ncipollo/release-action@v1
with:
prerelease: true
name: "b2s-designer-${{ needs.version.outputs.sha7 }}"
tag: "b2s-designer-${{ needs.version.outputs.sha7 }}"
commit: ${{ needs.version.outputs.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "*"
14 changes: 14 additions & 0 deletions B2STools/B2STools.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
___ ___ ___ _____ _
| _ )_ ) __| |_ _|__ ___| |___
| _ \/ /\__ \ | |/ _ \/ _ \ (_-<
|___/___|___/ |_|\___/\___/_/__/


Older pinball machines used reels to display scores on the screen. B2S Server has built-in sounds for the reel movements. Some table authors do not like these sounds and want to control them from the table instead.

The script directb2sReelSoundsONOFF.cmd will disable the sounds played by the server by telling the server that the sounds do not exist.
What it technically does is add some "Sound1-6" attributes to the Score tags in the directb2s file:

<Score Parent="Backglass" ID="1" B2SStartDigit="0" Digits="5" Spacing="100" Sound1="" Sound2="" Sound3="" />

This will tell the B2S Server to keep quiet for these reels.
33 changes: 33 additions & 0 deletions B2STools/directb2sReelSoundsONOFF.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@echo off
REM directb2sReelSoundsONOFF.cmd call xslt transformation to add or remove empty attributes for directb2s files
setlocal

set "xsltFilePath=%~dpn0.xsl"

:loop
call :transform "%~1"

shift
if not "%~1"=="" goto loop

pause
goto :EOF
:transform
set "xmlFilePath=%~1"
set "outputFilePath=%~dpn1-updated.directb2s"

echo Transforming "%xmlFilePath%"
echo to "%outputFilePath%"
if not "%~x1" == ".directb2s" echo This only support directb2s files not "%1"&goto :EOF

powershell -Command ^
$xmlFilePath = '%xmlFilePath%'; ^
$xsltFilePath = '%xsltFilePath%'; ^
$outputFilePath = '%outputFilePath%'; ^
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform; ^
$xslt.Load($xsltFilePath); ^
$xslt.Transform($xmlFilePath, $outputFilePath);

if %ERRORLEVEL% GEQ 1 echo Transformation error!&goto :EOF
echo Transformation complete.

56 changes: 56 additions & 0 deletions B2STools/directb2sReelSoundsONOFF.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" />
<!-- directb2sReelSoundsONOFF.xsl xslt transformation to add empty sound attributes for directb2s files -->

<!-- Identity template: copy all nodes and attributes as-is -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="Scoret/@*[starts-with(name(), 'Sound') and @* ='']" >
<xsl:message>
This does not work yet
</xsl:message>
</xsl:template>

<!-- Match the "Score" node and add the "Sound1-6" empty attributes -->
<xsl:template match="Score[not(@Sound1)]">
<xsl:message>
Adding the Sound -<xsl:value-of select="@Digits"/> attributes to Score ID="<xsl:value-of select="@ID"/>"
</xsl:message>

<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="Sound1"></xsl:attribute>
<xsl:if test="@Digits &gt; 1">
<xsl:attribute name="Sound2"></xsl:attribute>
</xsl:if>
<xsl:if test="@Digits &gt; 2">
<xsl:attribute name="Sound3"></xsl:attribute>
</xsl:if>
<xsl:if test="@Digits &gt; 3">
<xsl:attribute name="Sound4"></xsl:attribute>
</xsl:if>
<xsl:if test="@Digits &gt; 4">
<xsl:attribute name="Sound5"></xsl:attribute>
</xsl:if>
<xsl:if test="@Digits &gt; 5">
<xsl:attribute name="Sound6"></xsl:attribute>
</xsl:if>
<xsl:if test="@Digits &gt; 6">
<xsl:attribute name="Sound7"></xsl:attribute>
</xsl:if>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>

<!-- Match the "Score" with a "Sound1" node error out -->
<xsl:template match="Score[(@Sound1)]">
<xsl:message terminate="yes">
The sound attribute(s) already exists
</xsl:message>
</xsl:template>

</xsl:stylesheet>
140 changes: 140 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# VPinball Code of Conduct

This code of conduct outlines our expectations for participants within
the VPinball community, as well as steps for reporting unacceptable behavior.
We are committed to providing a welcoming and inspiring community for
all and expect our code of conduct to be honored. Anyone who violates
this code of conduct may be banned from the community.

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[INSERT CONTACT METHOD].

All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
at [https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

Loading

0 comments on commit 5f87af7

Please sign in to comment.