Skip to content

Commit

Permalink
Add Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
benbaker76 committed May 5, 2023
1 parent 26635b7 commit 6ce179e
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 95 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/amd64_linux_gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: amd64_linux_gcc

on: [push]

jobs:

amd64_linux_gcc:
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- run: make
- name: Get version
id: version
run: |
output=$(build/gfx2next -version)
echo "::set-output name=result::$output"
- name: Copy README.md
run: cp README.md build
- name: Compress Files
uses: a7ul/[email protected]
with:
command: c
cwd: build
files: |
README.md
gfx2next
outPath: build/gfx2next_Linux_amd64.tar.gz
- name: Upload to Artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/gfx2next_Linux_amd64.tar.gz
- name: Upload to Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/gfx2next_Linux_amd64.tar.gz
tag: ${{ steps.version.outputs.result }}
overwrite: true
40 changes: 40 additions & 0 deletions .github/workflows/amd64_macos_gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: amd64_macos_gcc

on: [push]

jobs:

amd64_macos_gcc:
runs-on: macos-12
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- run: make
- name: Get version
id: version
run: |
output=$(build/gfx2next -version)
echo "::set-output name=result::$output"
- name: Copy README.md
run: cp README.md build
- name: Compress Files
uses: a7ul/[email protected]
with:
command: c
cwd: build
files: |
README.md
gfx2next
outPath: build/gfx2next_Darwin_amd64.tar.gz
- name: Upload to Artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/gfx2next_Darwin_amd64.tar.gz
- name: Upload to Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/gfx2next_Darwin_amd64.tar.gz
tag: ${{ steps.version.outputs.result }}
overwrite: true
40 changes: 40 additions & 0 deletions .github/workflows/amd64_windows_gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: amd64_windows_gcc

on: [push]

jobs:

amd64_windows_gcc:
runs-on: windows-2019
timeout-minutes: 5
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
install: gcc make
- run: make
- name: Get version
id: version
run: |
output=$(build/gfx2next -version)
echo "::set-output name=result::$output"
- name: Compress Files
uses: vimtor/action-zip@v1
with:
files: README.md build/gfx2next.exe
dest: build/gfx2next_Windows_amd64.zip
- name: Upload to Artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/gfx2next_Windows_amd64.zip
- name: Upload to Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/gfx2next_Windows_amd64.zip
tag: ${{ steps.version.outputs.result }}
overwrite: true
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ CP := cp

ZIP := zip -r -q

BIN_DIR := bin
BUILD_DIR := build

TMP_DIR := tmp

EXE_BASE_NAME := gfx2next

EXE_FULL_NAME := $(BIN_DIR)/$(EXE_BASE_NAME)
EXE_FULL_NAME := $(BUILD_DIR)/$(EXE_BASE_NAME)

# common GNU variables related to install location
prefix ?= /usr/local
Expand All @@ -37,14 +37,14 @@ install: $(EXE_FULL_NAME)
distro: clean
$(MAKE) all
$(MKDIR) $(TMP_DIR)/gfx2next
$(CP) $(BIN_DIR)/* $(TMP_DIR)/gfx2next
$(CP) $(BUILD_DIR)/* $(TMP_DIR)/gfx2next
$(CP) src/* $(TMP_DIR)/gfx2next
$(CP) README.md $(TMP_DIR)/gfx2next
$(RM) build/gfx2next.zip
cd $(TMP_DIR); $(ZIP) ../build/gfx2next.zip gfx2next

clean:
$(RM) $(BIN_DIR) $(TMP_DIR)
$(RM) $(BUILD_DIR) $(TMP_DIR)

$(EXE_FULL_NAME): src/lodepng.c src/zx0.c src/gfx2next.c
$(MKDIR) $(@D)
Expand Down
Binary file removed bin/gfx2next.exe
Binary file not shown.
98 changes: 7 additions & 91 deletions src/gfx2next.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int _CRT_glob = 0;
#include "zx0.h"
#include "lodepng.h"

#define VERSION "1.1.7"
#define VERSION "1.1.8"

#define DIR_SEPERATOR_CHAR '\\'

Expand Down Expand Up @@ -112,59 +112,8 @@ int _CRT_glob = 0;
#define EXT_TMX ".tmx"
#define EXT_TSX ".tsx"

static void write_easter_egg();
static uint8_t attributes_to_tiled_flags(uint8_t attributes);

unsigned char m_gf[] =
{
0x84, 0xff, 0x42, 0x7c, 0xf8, 0x00, 0x07, 0xe0, 0x2a, 0xc0, 0x24, 0x00,
0x3f, 0x38, 0xc5, 0xe4, 0xf8, 0x01, 0xe2, 0xba, 0xfc, 0xc6, 0xe4, 0x80,
0xbe, 0xbf, 0xf0, 0xd8, 0x92, 0x7c, 0xfa, 0xe3, 0x38, 0xc1, 0x12, 0x86,
0x87, 0xe0, 0x7f, 0xe0, 0xbe, 0x1f, 0xf4, 0x87, 0xfe, 0x8f, 0xec, 0x6a,
0xe8, 0x43, 0x8f, 0x1e, 0xac, 0x6c, 0xc7, 0xda, 0x96, 0xf8, 0x4a, 0xf1,
0x02, 0x97, 0xf1, 0xc3, 0x22, 0xa7, 0x93, 0xfe, 0xc2, 0x8e, 0xf2, 0x3f,
0xf0, 0x96, 0xcf, 0x95, 0x9f, 0xbd, 0xdf, 0xb0, 0x7d, 0xe0, 0x2f, 0xe7,
0x50, 0x7d, 0xe0, 0x29, 0xff, 0x69, 0xf3, 0x29, 0xfc, 0x02, 0x92, 0xfb,
0x90, 0xfd, 0x2f, 0xf9, 0xf2, 0x0f, 0xce, 0x7f, 0xb3, 0xe0, 0x15, 0x29,
0xf3, 0x5a, 0xf7, 0x50, 0x4b, 0xf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0xfc, 0x19, 0x94, 0x00, 0xf8,
0x03, 0xfc, 0x3d, 0xe0, 0x3f, 0xe3, 0xe0, 0xa0, 0xf8, 0x62, 0x02, 0x7f,
0x56, 0x94, 0x3f, 0x89, 0x04, 0x9f, 0x48, 0x82, 0x06, 0xef, 0x84, 0xe8,
0xa0, 0xf7, 0xa1, 0xe0, 0x2f, 0xf9, 0x80, 0x4a, 0xfc, 0x52, 0x66, 0x04,
0xfe, 0x7f, 0x84, 0xf0, 0xbe, 0xff, 0xe0, 0x81, 0x90, 0xaa, 0x04, 0xff,
0x69, 0xa0, 0x5a, 0x60, 0x06, 0x86, 0x06, 0x94, 0x40, 0x89, 0xfe, 0x80,
0x06, 0xd9, 0x0e, 0xa2, 0x30, 0x00, 0x08
};

uint32_t m_screenColors[] =
{
COLOR_BLACK,
Expand Down Expand Up @@ -871,6 +820,7 @@ static void print_usage(void)
printf(" gfx2next [options] <srcfile> [<dstfile>]\n");
printf("\n");
printf("Options:\n");
printf(" -version Output version\n");
printf(" -debug Output additional debug information\n");
printf(" -font Sets output to Next font format (.spr)\n");
printf(" -screen Sets output to Spectrum screen format (.scr)\n");
Expand Down Expand Up @@ -1315,17 +1265,16 @@ static bool parse_args(int argc, char *argv[], arguments_t *args)
{
m_args.preview = true;
}
else if (!strcmp(argv[i], "-easter-egg"))
{
write_easter_egg();
exit(0);
return false;
}
else if (!strcmp(argv[i], "-help"))
{
print_usage();
return false;
}
else if (!strcmp(argv[i], "-version"))
{
printf("v%s\n", VERSION);
exit(EXIT_SUCCESS);
}
else
{
fprintf(stderr, "Invalid option: %s\n", argv[i]);
Expand Down Expand Up @@ -1945,39 +1894,6 @@ static void read_next_image()
}
}

static void write_1bit_png(const char *filename, uint8_t *data)
{
m_args.bitmap = true;
m_args.colors_4bit = true;

uint8_t buffer_decompress[0x800];
uint8_t buffer_out[0x2000];
memset(m_next_palette, 0, sizeof(m_next_palette));
memset(buffer_out, 0, sizeof(buffer_out));

m_next_palette[1] = 0x01ff;

zx0_decompress(data, buffer_decompress);

uint8_t *p_data = buffer_decompress;
uint8_t *p_buffer = buffer_out;

for (int i = 0; i < 0x800; i++)
{
for (int j = 0; j < 8; j++)
{
p_buffer[(i * 8 + j) >> 1] |= p_data[i] & (1 << (7 - j)) ? (j % 2) == 0 ? 0x10 : 1 : 0;
}
}

write_png(filename, buffer_out, 128, 128);
}

static void write_easter_egg()
{
write_1bit_png("gf.png", m_gf);
}

static void write_asm_header()
{
if (m_args.asm_mode == ASMMODE_SJASM)
Expand Down

0 comments on commit 6ce179e

Please sign in to comment.