Files
CTR-WebCam/scripts/build-3ds.sh
T
2025-10-28 19:17:52 +01:00

67 lines
1.8 KiB
Bash

#!/bin/bash
# Build the 3DS webcam app
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
APP_DIR="$PROJECT_ROOT/3ds-app"
DIST_DIR="$PROJECT_ROOT/dist"
echo "======================================"
echo "Building 3DS Webcam Bridge"
echo "======================================"
echo ""
# Check for devkitARM
if [ -z "$DEVKITARM" ]; then
echo "Error: DEVKITARM is not set!"
echo ""
echo "Please run: export DEVKITARM=/opt/devkitpro/devkitARM"
echo "Or run: ./scripts/install-devkitpro.sh"
exit 1
fi
# Check for stb_image_write.h
STB_HEADER="$APP_DIR/source/third_party/stb_image_write.h"
if ! grep -q "stbi_write_jpg_to_func" "$STB_HEADER" 2>/dev/null || grep -q "PLACEHOLDER" "$STB_HEADER"; then
echo "Warning: stb_image_write.h appears to be a placeholder!"
echo ""
echo "Downloading the real stb_image_write.h..."
wget https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h \
-O "$STB_HEADER" 2>/dev/null || {
echo ""
echo "Error: Could not download stb_image_write.h"
echo "Please download it manually from:"
echo " https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h"
echo "And place it at:"
echo " $STB_HEADER"
exit 1
}
echo "Downloaded successfully!"
echo ""
fi
# Create dist directory
mkdir -p "$DIST_DIR"
# Build
echo "Building..."
cd "$APP_DIR"
make clean
make -j$(nproc)
echo ""
echo "======================================"
echo "Build complete!"
echo "======================================"
echo ""
echo "Output files:"
ls -lh "$DIST_DIR"/3ds-webcam-bridge.*
echo ""
echo "To install on your 3DS:"
echo " 1. Copy $DIST_DIR/3ds-webcam-bridge.3dsx to your SD card at:"
echo " SD:/3ds/3ds-webcam-bridge/"
echo " 2. Launch via Homebrew Launcher"
echo ""