Compare commits

...

2 Commits

Author SHA1 Message Date
7f0dcdd280 [nostalgia/gfx/studio/tilesheet] Cleanup
All checks were successful
Build / build (push) Successful in 1m20s
2025-05-07 19:57:27 -05:00
6029ad5d47 [nostalgia/studio] Add command for bundling Mac app 2025-05-07 02:48:14 -05:00
3 changed files with 45 additions and 5 deletions

View File

@ -17,6 +17,10 @@ PROJECT_PLAYER=./build/${BC_VAR_CURRENT_BUILD}/bin/${BC_VAR_PROJECT_NAME_CAP}
pkg-gba: build pkg-gba: build
${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/pkg-gba.py sample_project ${BC_VAR_PROJECT_NAME_CAP} ${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/pkg-gba.py sample_project ${BC_VAR_PROJECT_NAME_CAP}
.PHONY: pkg-mac
pkg-mac: install
${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/pkg-dmg.py
.PHONY: generate-studio-rsrc .PHONY: generate-studio-rsrc
generate-studio-rsrc: generate-studio-rsrc:
${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/file-to-cpp.py --rsrc src/olympic/studio/applib/src/rsrc.json ${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/file-to-cpp.py --rsrc src/olympic/studio/applib/src/rsrc.json

View File

@ -6,14 +6,14 @@
namespace nostalgia::gfx { namespace nostalgia::gfx {
gfx::PaletteChangeCommand::PaletteChangeCommand( PaletteChangeCommand::PaletteChangeCommand(
TileSheet::SubSheetIdx idx, TileSheet::SubSheetIdx idx,
TileSheet &img, TileSheet &img,
ox::StringViewCR newPalette) noexcept: ox::StringViewCR newPalette) noexcept:
m_img(img), m_img{img},
m_idx(std::move(idx)), m_idx{std::move(idx)},
m_oldPalette(m_img.defaultPalette), m_oldPalette{m_img.defaultPalette},
m_newPalette(ox::sfmt<ox::IString<43>>("uuid://{}", newPalette)) { m_newPalette{ox::sfmt<ox::IString<43>>("uuid://{}", newPalette)} {
} }
ox::Error PaletteChangeCommand::redo() noexcept { ox::Error PaletteChangeCommand::redo() noexcept {

36
util/scripts/pkg-dmg.py Executable file
View File

@ -0,0 +1,36 @@
#! /usr/bin/env python3
import os
import shutil
import subprocess
import sys
def rm(path: str):
file_exists = os.path.exists(path)
is_link = os.path.islink(path)
is_dir = os.path.isdir(path)
if (file_exists or is_link) and not is_dir:
os.remove(path)
elif os.path.isdir(path):
shutil.rmtree(path)
def mkdir_p(path: str):
if not os.path.exists(path):
os.mkdir(path)
def run(args: list[str]):
if subprocess.run(args).returncode != 0:
sys.exit(1)
dmg_dir = 'dist/darwin-arm64-release/NostalgiaStudio'
dmg = f'{dmg_dir}.dmg'
rm(dmg)
rm(dmg_dir)
mkdir_p(dmg_dir)
shutil.copytree('dist/darwin-arm64-release/NostalgiaStudio.app', f'{dmg_dir}/NostalgiaStudio.app')
os.symlink('/Applications', f'{dmg_dir}/Applications')
run(['hdiutil', 'create', '-srcfolder', dmg_dir, dmg])