Skip to content

Commit

Permalink
Merge pull request #4 from pcm720/title-list-caching
Browse files Browse the repository at this point in the history
Title ID caching, QoL improvements
  • Loading branch information
pcm720 authored Oct 14, 2024
2 parents 2410fc3 + 87e5577 commit f235bc2
Show file tree
Hide file tree
Showing 20 changed files with 766 additions and 250 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Build

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/ps2homebrew/ps2homebrew:main
steps:
- uses: actions/checkout@v4

- name: Fetch full clone
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git fetch --prune --unshallow
- name: Compile project
id: make
run: |
make
- name: Upload ELF
uses: actions/upload-artifact@v4
if: steps.make.outcome == 'success'
with:
name: nhddl
path: |
nhddl-*.elf
!nhddl-*_unc.elf
- name: Upload YAML examples
if: steps.make.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: examples
path: |
examples/*.yaml
release:
needs: [build]
runs-on: ubuntu-latest
permissions: write-all
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4

- name: Fetch full clone
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git fetch --prune --unshallow
- name: Get git describe
run: |
echo "GIT_VERSION=$(git describe --always --dirty --tags --exclude nightly)" >> $GITHUB_ENV
- name: Download all artifacts
uses: actions/download-artifact@v4

- name: Prepare release archive
run: |
mv nhddl/nhddl-${{ env.GIT_VERSION }}.elf nhddl.elf
zip -r nhddl-${{ env.GIT_VERSION }}.zip nhddl.elf examples
- uses: "marvinpinto/action-automatic-releases@latest"
if: github.ref == 'refs/heads/main'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "nightly"
prerelease: true
title: "Nightly build"
files: |
nhddl-${{ env.GIT_VERSION }}.zip
- uses: "marvinpinto/action-automatic-releases@latest"
if: startsWith(github.ref, 'refs/tags/v')
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
draft: true
files: |
nhddl-${{ env.GIT_VERSION }}.zip
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ obj/
*.irx
*.yaml
*.toml
!examples/*.yaml
# Created by https://www.toptal.com/developers/gitignore/api/macos,windows,linux

### Linux ###
Expand Down
42 changes: 35 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#.SILENT:

EE_BIN = nhddl_unc.elf
EE_BIN_PKD = nhddl.elf
GIT_VERSION := $(shell git describe --always --dirty --tags --exclude nightly)

EE_OBJS = main.o module_init.o common.o iso.o history.o options.o gui.o pad.o launcher.o
ELF_BASE_NAME := nhddl-$(GIT_VERSION)

EE_BIN = $(ELF_BASE_NAME)_unc.elf
EE_BIN_PKD = $(ELF_BASE_NAME).elf
EE_BIN_DEBUG := $(ELF_BASE_NAME)-debug_unc.elf
EE_BIN_DEBUG_PKD := $(ELF_BASE_NAME)-debug.elf

EE_OBJS = main.o module_init.o common.o iso.o history.o options.o gui.o pad.o launcher.o iso_cache.o
IRX_FILES += sio2man.irx mcman.irx mcserv.irx fileXio.irx iomanX.irx freepad.irx
RES_FILES += icon_A.sys icon_C.sys icon_J.sys

Expand All @@ -18,20 +24,36 @@ EE_OBJS := $(EE_OBJS:%=$(EE_OBJS_DIR)%)
EE_INCS := -Iinclude -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/ports/include

EE_LDFLAGS := -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ports/lib -s
EE_LIBS = -ldebug -lfileXio -lpatches -lelf-loader -lgsKit -ldmaKit -lgskit_toolkit -lpng -lz -ltiff -lpad
EE_CFLAGS := -mno-gpopt -G0
EE_LIBS = -ldebug -lfileXio -lpatches -lelf-loader -lgskit -ldmakit -lgskit_toolkit -lpng -lz -ltiff -lpad
EE_CFLAGS := -mno-gpopt -G0 -DGIT_VERSION="\"${GIT_VERSION}\""

BIN2C = $(PS2SDK)/bin/bin2c

.PHONY: all clean
NEEDS_REBUILD := 0
ifeq ($(DEBUG), 1)
# If DEBUG=1, output targets to debug names
EE_BIN = $(EE_BIN_DEBUG)
EE_BIN_PKD = $(EE_BIN_DEBUG_PKD)
# Define DEBUG
EE_CFLAGS += -DDEBUG
# Set rebuild flag
NEEDS_REBUILD = 1
else ifneq ("$(wildcard $(EE_BIN_DEBUG))","")
# Else, set rebuild flag if EE_BIN_DEBUG exists
NEEDS_REBUILD = 1
endif

.PHONY: all clean .FORCE

.FORCE:

all: $(EE_BIN_PKD)

$(EE_BIN_PKD): $(EE_BIN)
ps2-packer $< $@

clean:
rm -rf $(EE_BIN) $(EE_BIN_PKD) $(EE_ASM_DIR) $(EE_OBJS_DIR)
rm -rf $(EE_BIN) $(EE_BIN_PKD) $(EE_BIN_DEBUG) $(EE_BIN_DEBUG_PKD) $(EE_ASM_DIR) $(EE_OBJS_DIR)

# IRX files
%_irx.c:
Expand All @@ -46,8 +68,14 @@ $(EE_ASM_DIR):
$(EE_OBJS_DIR):
@mkdir -p $@

ifeq ($(NEEDS_REBUILD),1)
# If rebuild flag is set, add .FORCE to force full rebuild
$(EE_OBJS_DIR)%.o: $(EE_SRC_DIR)%.c .FORCE | $(EE_OBJS_DIR)
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
else
$(EE_OBJS_DIR)%.o: $(EE_SRC_DIR)%.c | $(EE_OBJS_DIR)
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
endif

$(EE_OBJS_DIR)%.o: $(EE_ASM_DIR)%.c | $(EE_OBJS_DIR)
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
Expand Down
Loading

0 comments on commit f235bc2

Please sign in to comment.