Compare commits

...

18 Commits

Author SHA1 Message Date
Nut.andor
861c4c3bb1 Merge branch 'pulls/1195352/8' 2025-06-28 21:23:39 +02:00
Nut.andor
c18fcfc667 Auto-Package on release 2025-06-28 20:46:50 +02:00
Nut.andor
9b1ac0d3e1 new item sprite (map objects) 2025-06-28 20:45:16 +02:00
Nut.andor
eb6377a983 Adding better error message in TMX input 2025-03-16 20:17:57 +01:00
Nut.andor
2fb16c9213 missing JDK in misc.xml 2025-03-16 20:17:32 +01:00
Nut.andor
6741100a4f Pull Request #8: Auto-Package on release 2025-02-18 23:52:51 +01:00
OMGeeky
dbff7fb571 Refactor version handling to read APP_VERSION from ATCS_latest file
(cherry picked from commit c9cccf9eb2)
2025-02-18 23:34:08 +01:00
OMGeeky
dfb3e31a7a Update package.sh to copy version file from VERSION_FILE variable
(cherry picked from commit 5ff45746d8)
2025-02-18 23:33:48 +01:00
OMGeeky
022c9ad229 Update release workflow to read version from the correct file path
(cherry picked from commit f14d21e322)
2025-02-18 23:33:27 +01:00
OMGeeky
38a3d4082b Update package.sh to reference ATCS_latest from the source directory and copy it to the temporary packaging directory
(cherry picked from commit 5191f56a01)
2025-02-18 23:31:20 +01:00
OMGeeky
cd78ee3ad0 Add .gitattributes to normalize line endings and enforce LF for bash scripts
(cherry picked from commit a71e8fe0a4)
2025-02-18 23:29:00 +01:00
OMGeeky
7b30cc6355 Remove unnecessary exit command from ATCS.sh
(cherry picked from commit a76d425ab7)
2025-02-18 23:29:00 +01:00
OMGeeky
9a6c5ecf6e delete obsolete Linux folder 2025-02-18 22:34:29 +01:00
OMGeeky
ed81c2382f Fix some issues with the linux ATCS.sh when the current path has spaces etc. 2025-02-18 22:33:08 +01:00
OMGeeky
ed2ad56b76 cleanup some packaging stuff 2025-02-18 18:08:02 +01:00
OMGeeky
becf45f249 Refactor release workflow to consolidate asset uploads 2025-02-16 01:19:20 +01:00
OMGeeky
c950324cd9 Reorder NSIS installation step in release workflow 2025-02-16 01:10:25 +01:00
OMGeeky
b58d080f4d Update installer script and release workflow to improve version handling 2025-02-16 01:07:44 +01:00
15 changed files with 76 additions and 109 deletions

6
.gitattributes vendored Normal file
View File

@@ -0,0 +1,6 @@
# Set default behavior to automatically normalize line endings.
* text=auto
# Force bash scripts to always use LF line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lf

View File

@@ -16,8 +16,9 @@ jobs:
shell: bash
run: |
echo "Reading version from file:"
cat packaging/ATCS_latest
VERSION=$(cat packaging/ATCS_latest | sed 's/^v//' | sed 's/[^0-9.]//g')
cat res/ATCS_latest
echo ""
VERSION=$(tr -d '[:space:]' < "res/ATCS_latest")
echo "Processed version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Environment variable set to: $VERSION"
@@ -26,10 +27,7 @@ jobs:
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Install NSIS
uses: joncloud/makensis-action@v4
distribution: 'temurin'
- name: Build JAR
shell: bash
@@ -39,35 +37,20 @@ jobs:
echo "Building JAR and ZIP for version: ${{ env.VERSION }}"
./package.sh -windows
echo "Created artifacts:"
ls -la ATCS_${{ env.VERSION }}.zip
ls -la common/ATCS.jar
ls -la ATCS_${{ env.VERSION }}.zip
- name: Create Installer
shell: bash
run: |
cd packaging/Windows
ls -la
echo "Building installer for version: ${{ env.VERSION }}"
makensis /DVERSION="${{ env.VERSION }}" ATCS_Installer.nsi
echo "Created installer:"
ls -la ATCS_v${{ env.VERSION }}_Setup.exe
- name: Install NSIS
uses: joncloud/makensis-action@v4
with:
script-file: packaging/Windows/ATCS_Installer.nsi
arguments: /DVERSION="${{ env.VERSION }}"
- name: Upload ZIP to Release
uses: actions/upload-release-asset@v1
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./packaging/ATCS_${{ env.VERSION }}.zip
asset_name: ATCS_${{ env.VERSION }}.zip
asset_content_type: application/zip
- name: Upload Installer to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./packaging/Windows/ATCS_v${{ env.VERSION }}_Setup.exe
asset_name: ATCS_v${{ env.VERSION }}_Setup.exe
asset_content_type: application/octet-stream
files: |
./packaging/ATCS_${{ env.VERSION }}.zip
./packaging/ATCS_${{ env.VERSION }}_Setup.exe

2
.idea/misc.xml generated
View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" default="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK" />
</project>

View File

@@ -98,7 +98,11 @@ public class TileSet implements Iterable<Tile>
File f = new File(imgFilename);
BufferedImage image = ImageIO.read(f.getCanonicalFile());
BufferedImage image;
try {
image = ImageIO.read(f.getCanonicalFile());
} catch (IOException e) { throw new IOException("Failed to load " + imgFilename);
}
if (image == null) {
throw new IOException("Failed to load " + imgFilename);
}

View File

@@ -1,2 +0,0 @@
/ATCS_v*.zip
/ATCS_v*.zip.rename

View File

@@ -1,20 +0,0 @@
@echo off
set "ATCS_DIR=%~dp0"
set "MAX_MEM=512M"
set "CP=%ATCS_DIR%lib\*"
set "JAVA=javaw.exe"
set "JAVA_OPTS=-DFONT_SCALE=1.0 -Dswing.aatext=true"
set "ENV_FILE=%ATCS_DIR%ATCS.env.bat"
set "MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio"
if exist "%ENV_FILE%" (
call "%ENV_FILE%"
) else (
echo REM set "MAX_MEM=%MAX_MEM%">"%ENV_FILE%"
echo REM set "JAVA=%JAVA%">>"%ENV_FILE%"
echo REM set "JAVA_OPTS=%JAVA_OPTS%">>"%ENV_FILE%"
echo.>>"%ENV_FILE%"
)
start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -cp "%CP%" %MAIN_CLASS%

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -1,22 +0,0 @@
#!/bin/bash
ATCS_DIR=$(dirname $(readlink -f "$0" || greadlink -f "$0" || stat -f "$0"))
MAX_MEM=512M
CP=$(find ${ATCS_DIR}/lib/ -name '*.jar' | paste -sd: -)
JAVA=java
JAVA_OPTS='-DFONT_SCALE=1.0 -Dswing.aatext=true'
ENV_FILE=${ATCS_DIR}/ATCS.env
MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio
if [ -f ${ENV_FILE} ]
then
source ${ENV_FILE}
else
echo "#MAX_MEM=${MAX_MEM}" > ${ENV_FILE}
echo "#JAVA=${JAVA}" >> ${ENV_FILE}
echo "#JAVA_OPTS=${JAVA_OPTS}" >> ${ENV_FILE}
echo "" >> ${ENV_FILE}
fi
export ENV_FILE
$JAVA ${JAVA_OPTS} -Xmx${MAX_MEM} -cp ${CP} ${MAIN_CLASS}

View File

@@ -1 +0,0 @@
/*.jar

View File

@@ -1,12 +1,12 @@
!include MUI2.nsh
; Version will be passed as /DVERSION=x.x.x
; Version will be passed as /DVERSION=vx.x.x
!define TRAINER_VERSION "0.1.5"
!define JAVA_BIN "java"
!define ATCS_SOURCE_DIR "..\..\"
Name "Andor's Trail Content Studio v${VERSION}"
OutFile "ATCS_v${VERSION}_Setup.exe"
Name "Andor's Trail Content Studio ${VERSION}"
OutFile "..\ATCS_${VERSION}_Setup.exe"
InstallDir "$PROGRAMFILES\ATCS\"
;SetCompressor /SOLID /FINAL lzma
@@ -14,10 +14,10 @@ InstallDir "$PROGRAMFILES\ATCS\"
Var StartMenuFolder
!define MUI_WELCOMEPAGE_TITLE "Welcome to Andor's Trail Content Studio installer"
!define MUI_WELCOMEPAGE_TEXT "This will install Andor's Trail Content Studio v${VERSION}"
!define MUI_FINISHPAGE_TEXT "Andor's Trail Content Studio v${VERSION} - Install completed !"
!define MUI_WELCOMEPAGE_TEXT "This will install Andor's Trail Content Studio ${VERSION}"
!define MUI_FINISHPAGE_TEXT "Andor's Trail Content Studio ${VERSION} - Install completed !"
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Andor's Trail Content Studio"
!define MUI_PAGE_HEADER_TEXT "Installing Andor's Trail Content Studio v${VERSION}"
!define MUI_PAGE_HEADER_TEXT "Installing Andor's Trail Content Studio ${VERSION}"
;Start Menu Folder Page Configuration

View File

@@ -1,21 +1,26 @@
#!/bin/bash
ATCS_DIR=$(dirname $(readlink -f "$0" || greadlink -f "$0" || stat -f "$0"))
ATCS_DIR="$(dirname "$(readlink -f "$0" || greadlink -f "$0" || stat -f "$0")")"
echo "ATCS_DIR: '${ATCS_DIR}'"
MAX_MEM=512M
JAVA=java
MAX_MEM="512M"
JAVA="java"
JAVA_OPTS='-DFONT_SCALE=1.0 -Dswing.aatext=true'
ENV_FILE=${ATCS_DIR}/ATCS.env
if [ -f ${ENV_FILE} ]; then
source ${ENV_FILE}
ENV_FILE="${ATCS_DIR}/ATCS.env"
if [ -f "${ENV_FILE}" ]; then
source "${ENV_FILE}"
else
echo "#MAX_MEM=${MAX_MEM}" >${ENV_FILE}
echo "#JAVA=${JAVA}" >>${ENV_FILE}
echo "#JAVA_OPTS=${JAVA_OPTS}" >>${ENV_FILE}
echo "" >>${ENV_FILE}
{
echo "#MAX_MEM=\"${MAX_MEM}\""
echo "#JAVA=\"${JAVA}\""
echo "#JAVA_OPTS=\"${JAVA_OPTS}\""
echo ""
}>"${ENV_FILE}"
fi
export ENV_FILE
$JAVA ${JAVA_OPTS} -Xmx${MAX_MEM} -jar ${ATCS_DIR}/ATCS.jar
# shellcheck disable=SC2086
# (spellchecker is disabled for this line, because we want it to be split into multiple arguments)
$JAVA ${JAVA_OPTS} -Xmx${MAX_MEM} -jar "${ATCS_DIR}/ATCS.jar"

View File

@@ -18,7 +18,7 @@ ATCS_SOURCE_DIR=$(dirname "${PACKAGING_DIR}")
TEMP_DIR="${PACKAGING_DIR}/tmp"
JAR_LOCATION="${PACKAGING_DIR}/ATCS.jar" # Output JAR location as per script
MANIFEST_LOCATION="${PACKAGING_DIR}/Manifest.txt"
VERSION_FILE="${PACKAGING_DIR}/ATCS_latest"
VERSION_FILE="${ATCS_SOURCE_DIR}/res/ATCS_latest"
SOURCE_BASE_DIR="${ATCS_SOURCE_DIR}/src" # Base directory for standard source code
LIB_BASE_DIR="${ATCS_SOURCE_DIR}/lib" # Base directory for libraries
@@ -29,7 +29,7 @@ EXTRA_SOURCE_DIRS=(
"siphash-zackehh/src/main/java"
)
# --- Libraries to include (from IntelliJ artifact definition) ---
# --- Libraries to include ---
LIBRARIES=(
"AndorsTrainer_v0.1.5.jar"
"bsh-2.0b4.jar"
@@ -44,7 +44,7 @@ LIBRARIES=(
# --- Get version ---
echo "Getting version"
VERSION=$(cat "${VERSION_FILE}")
VERSION=$(tr -d '[:space:]' < "${VERSION_FILE}")
echo "Got version ${VERSION}"
# --- Prepare temporary directory ---
@@ -62,7 +62,7 @@ done
# --- Set ClassPath ---
echo "Getting source files"
# Find all java files in source directories and compile them
# Find all java files in source directories
SOURCE_FILES=$(find "${SOURCE_BASE_DIR}" "${EXTRA_SOURCE_DIRS[@]/#/${ATCS_SOURCE_DIR}/}" -name "*.java" -print)
#echo "SourceFiles: ${SOURCE_FILES}"
echo ""
@@ -70,6 +70,8 @@ echo ""
# --- Build Java classes ---
echo 'Building java classes'
# shellcheck disable=SC2086
# (we need word splitting here to pass multiple files)
javac -cp "${TEMP_DIR}" -d "${TEMP_DIR}" ${SOURCE_FILES}
if [ $? -ne 0 ]; then
echo "Compilation failed. Please check errors above."
@@ -84,6 +86,7 @@ mkdir -p "${TEMP_DIR}/com/gpl/rpg/atcontentstudio/img"
mkdir -p "${TEMP_DIR}/tiled/io/resources/"
cp -r "${ATCS_SOURCE_DIR}"/src/com/gpl/rpg/atcontentstudio/img/* "${TEMP_DIR}/com/gpl/rpg/atcontentstudio/img/" # some icons
cp -r "${ATCS_SOURCE_DIR}"/hacked-libtiled/tiled/io/resources/* "${TEMP_DIR}/tiled/io/resources/" # dtd file for tmx maps
cp "${VERSION_FILE}" "${TEMP_DIR}/" # Copy version file
# --- Create JAR file ---
echo ""
@@ -114,7 +117,10 @@ else
# Use zip command on Linux
zip -r "ATCS_${VERSION}.zip" common/* # archive the 'common' folder which now contains the JAR and libs
fi
if [ $? -ne 0 ]; then
echo "Archive creation failed."
exit 1
fi
echo "Created archive at ${PACKAGING_DIR}/ATCS_${VERSION}.zip"
cd "${PACKAGING_DIR}" || exit
echo "Script finished."

View File

@@ -14,11 +14,7 @@ import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -42,8 +38,7 @@ import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
public class ATContentStudio {
public static final String APP_NAME = "Andor's Trail Content Studio";
public static final String APP_VERSION = "v0.6.21";
public static final String APP_VERSION = readVersionFromFile();
public static final String CHECK_UPDATE_URL = "https://andorstrail.com/static/ATCS_latest";
public static final String DOWNLOAD_URL = "https://andorstrail.com/viewtopic.php?f=6&t=4806";
@@ -231,4 +226,13 @@ public class ATContentStudio {
}
}
}
private static String readVersionFromFile() {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(
Objects.requireNonNull(ATContentStudio.class.getResourceAsStream("/ATCS_latest"))))) {
return reader.readLine();
} catch (IOException e) {
e.printStackTrace();
return "unknown";
}
}
}

View File

@@ -333,6 +333,10 @@ public class NPC extends JSONElement {
}
if (this.icon_id != null) {
String spritesheetId = this.icon_id.split(":")[0];
if (proj.getSpritesheet(spritesheetId) == null) {
Notification.addError("Error Spritesheet "+id+". has no backlink.");
return;
}
proj.getSpritesheet(spritesheetId).addBacklink(this);
}