Skip to content

Commit

Permalink
gust_enc: Fix locating of the seeds when running in a different direc…
Browse files Browse the repository at this point in the history
…tory

Plus: fix build badges and update windows.yml build file
  • Loading branch information
VitaSmith committed Dec 21, 2022
1 parent ec74715 commit 154dcf8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:

jobs:
build:
runs-on: windows-2022
runs-on: windows-latest

steps:
- name: Checkout repository
Expand All @@ -18,11 +18,12 @@ jobs:
submodules: recursive

- name: Set version
shell: bash
id: set_version
run: echo "::set-output name=version::$(git describe --tags --abbrev=0)"
run: echo "version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.3
uses: microsoft/setup-msbuild@v1

- name: Build
run: msbuild ${{ env.PROJECT_NAME }}.sln /m /p:Configuration=Release /p:Platform=x86 /p:AppVersion=${{ steps.set_version.outputs.version }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Gust Tools

[![Windows Build](https://img.shields.io/github/workflow/status/VitaSmith/gust_tools/Windows.svg?style=flat-square&label=Windows%20Build)](https://github.com/VitaSmith/gust_tools/actions/workflows/windows.yml)
[![Linux Build](https://img.shields.io/github/workflow/status/VitaSmith/gust_tools/Linux.svg?style=flat-square&label=Linux%20Build)](https://github.com/VitaSmith/gust_tools/actions/workflows/linux.yml)
[![Windows Build](https://img.shields.io/github/actions/workflow/status/VitaSmith/gust_tools/windows.yml?style=flat-square&label=Windows%20Build)](https://github.com/VitaSmith/gust_tools/actions/workflows/windows.yml)
[![Linux Build](https://img.shields.io/github/actions/workflow/status/VitaSmith/gust_tools/linux.yml?style=flat-square&label=Linux%20Build)](https://github.com/VitaSmith/gust_tools/actions/workflows/linux.yml)
[![Github stats](https://img.shields.io/github/downloads/VitaSmith/gust_tools/total.svg?style=flat-square&label=Downloads)](https://github.com/VitaSmith/gust_tools/releases)
[![Latest release](https://img.shields.io/github/release-pre/VitaSmith/gust_tools?style=flat-square&label=Latest%20Release)](https://github.com/VitaSmith/gust_tools/releases)

Expand Down
9 changes: 5 additions & 4 deletions gust_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,8 @@ static uint32_t unscramble(uint8_t* payload, uint32_t payload_size, seed_data* s
uint32_t* working_size, uint32_t expected_version)
{
uint32_t version = getbe32(payload);
if (version == 0x03000000) {
version = 3;
if ((version & 0x00ffffff) == 0) {
version >>= 24;
is_big_endian = false;
}
if ((version != 2) && (version != 3)) {
Expand Down Expand Up @@ -805,11 +805,12 @@ static void compute_prime_list(uint32_t max_value)
int main_utf8(int argc, char** argv)
{
seed_data seeds;
char path[256];
char path[PATH_MAX];
uint32_t src_size, dst_size;
uint8_t *src = NULL, *dst = NULL;
int r = -1;
const char* app_name = _appname(argv[0]);
const char* dir_name = _dirname(argv[0]);
if ((argc < 2) || ((argc == 3) && (*argv[1] != '-'))) {
printf("%s %s (c) 2019-2021 VitaSmith\n\nUsage: %s [-GAME_ID] <file>\n\n"
"Encode or decode a Gust .e file.\n\n"
Expand All @@ -821,7 +822,7 @@ int main_utf8(int argc, char** argv)
}

// Populate the descrambling seeds from the JSON file
snprintf(path, sizeof(path), "%s.json", app_name);
snprintf(path, sizeof(path), "%s%c%s.json", dir_name, PATH_SEP, app_name);
JSON_Value* json = json_parse_file_with_comments(path);
if (json == NULL) {
fprintf(stderr, "ERROR: Can't parse JSON data from '%s'\n", path);
Expand Down
8 changes: 4 additions & 4 deletions test_g1t.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@rem This test script performs unpack and repack of G1T
@rem textures and validates that the data matches.
@rem The texture test files can be downloaded from:
@rem https://vitasmith.rpc1.org/gust_tools/test_g1t.7z
@rem This test script performs unpack and repack of G1T textures and
@rem validates that the data matches.
@rem The latest texture test files can be downloaded from:
@rem https://github.com/VitaSmith/test_g1t/archive/refs/tags/2022-09-06.zip
@rem
@echo off
setlocal EnableDelayedExpansion
Expand Down

0 comments on commit 154dcf8

Please sign in to comment.