Remove Makefile and update build docs

This commit is contained in:
Matt Penny 2024-11-16 19:52:30 -05:00
parent 771c06d934
commit c35e2e64fc
25 changed files with 393 additions and 1094 deletions

1
.gitignore vendored
View File

@ -10,7 +10,6 @@ build/
debugger/ debugger/
gfxvalidator/ gfxvalidator/
assets/locales/
assets_working/ assets_working/
portal_pak_dir/ portal_pak_dir/
portal_pak_modified/ portal_pak_modified/

View File

@ -2,7 +2,6 @@ FROM ubuntu:24.04
WORKDIR /usr/src/app WORKDIR /usr/src/app
ENV N64_LIBGCCDIR /opt/crashsdk/lib/gcc/mips64-elf/12.2.0
ENV PATH /opt/crashsdk/bin:$PATH ENV PATH /opt/crashsdk/bin:$PATH
ENV PATH /root/.local/bin:$PATH ENV PATH /root/.local/bin:$PATH
ENV ROOT /etc/n64 ENV ROOT /etc/n64
@ -40,6 +39,7 @@ RUN apt-get update -y && \
lua5.4 \ lua5.4 \
makemask \ makemask \
newlib-mips-n64 \ newlib-mips-n64 \
ninja-build \
nodejs \ nodejs \
n64sdk \ n64sdk \
pip \ pip \
@ -58,10 +58,10 @@ RUN wget -P /opt/blender https://download.blender.org/release/Blender3.6/blender
RUN tar -xf /opt/blender/blender-3.6.1-linux-x64.tar.xz -C /opt/blender RUN tar -xf /opt/blender/blender-3.6.1-linux-x64.tar.xz -C /opt/blender
RUN rm /opt/blender/blender-3.6.1-linux-x64.tar.xz RUN rm /opt/blender/blender-3.6.1-linux-x64.tar.xz
ENV BLENDER_3_6 /opt/blender/blender-3.6.1-linux-x64/blender ENV PATH="$PATH:/opt/blender/blender-3.6.1-linux-x64"
RUN pipx ensurepath --force RUN pipx ensurepath --force
RUN pipx install vpk RUN pipx install vpk
# Avoid "dubious ownership" error when running git commands # Avoid "dubious ownership" error when running git commands
RUN git config --global --add safe.directory "$PWD" RUN git config --global --add safe.directory "$PWD"

694
Makefile
View File

@ -1,694 +0,0 @@
#!smake
# --------------------------------------------------------------------
# Copyright (C) 1998 Nintendo. (Originated by SGI)
#
# $RCSfile: Makefile,v $
# $Revision: 1.1.1.1 $
# $Date: 2002/05/02 03:27:21 $
# --------------------------------------------------------------------
include $(N64_ROOT)/usr/include/n64/make/PRdefs
SKELETOOL64:=skeletool64/build/skeletool64
VTF2PNG:=vtf2png
SFZ2N64:=sfz2n64
$(SKELETOOL64):
cmake -S skeletool64 -B skeletool64/build
cmake --build skeletool64/build
# Use tag name if the current commit is tagged, otherwise use commit hash
# If not in a git repo, fall back to exported version
GAME_VERSION := $(shell \
(git describe --tags HEAD 2>/dev/null || cat version.txt) | \
awk -F '-' '{print (NF >= 3 ? substr($$3, 2) : $$1)}' \
)
OPTIMIZER := -Os
LCDEFS := -DGAME_VERSION=\"$(GAME_VERSION)\" -g -Werror -Wall
N64LIB := -lultra_rom
ifeq ($(PORTAL64_WITH_DEBUGGER),1)
LCDEFS += -DPORTAL64_WITH_DEBUGGER
endif
ifeq ($(PORTAL64_WITH_RSP_PROFILER),1)
LCDEFS += -DPORTAL64_WITH_RSP_PROFILER
endif
BASE_TARGET_NAME = build/portal
LD_SCRIPT = linker/portal.ld
CP_LD_SCRIPT = build/portal
SCENE_SCALE = 128
ASMFILES = $(shell find asm/ -type f -name '*.s')
ASMOBJECTS = $(patsubst %.s, build/%.o, $(ASMFILES))
CODEFILES = $(shell find src/ -type f -name '*.c' | sort)
ifeq ($(PORTAL64_WITH_GFX_VALIDATOR),1)
LCDEFS += -DPORTAL64_WITH_GFX_VALIDATOR
CODEFILES += gfxvalidator/validator.c gfxvalidator/error_printer.c gfxvalidator/command_printer.c
endif
CODESEGMENT = build/code_segment
BOOT_CODE = $(N64_ROOT)/usr/lib/n64/PR/bootcode/boot.6102
RSP_BOOT = $(N64_ROOT)/usr/lib/n64/PR/rspboot.o
RSP_UCODE = $(N64_ROOT)/usr/lib/n64/PR/gspF3DEX2.fifo.o
ASP_UCODE = $(N64_ROOT)/usr/lib/n64/PR/aspMain.o
DEPS = $(patsubst %.c, build/%.d, $(CODEFILES)) $(patsubst %.c, build/%.d, $(DATAFILES))
-include $(DEPS)
LCINCS = -I$(N64_ROOT)/usr/include/n64/PR -Isrc/
LCDEFS += -DF3DEX_GBI_2 -DSCENE_SCALE=${SCENE_SCALE}
#LCDEFS += -DF3DEX_GBI_2 -DFOG
#LCDEFS += -DF3DEX_GBI_2 -DFOG -DXBUS
#LCDEFS += -DF3DEX_GBI_2 -DFOG -DXBUS -DSTOP_AUDIO
LDDIRS = -L$(N64_ROOT)/usr/lib/n64
LDFLAGS = $(N64LIB) $(shell $(CC) -print-libgcc-file-name)
default: english_audio
english_audio: build/src/audio/subtitles.h portal_pak_dir $(SKELETOOL64)
@$(MAKE) $(SKELETOOL64)
@$(MAKE) buildgame
all_languages: build/src/audio/subtitles.h portal_pak_dir german_audio french_audio russian_audio spanish_audio $(SKELETOOL64)
@$(MAKE) $(SKELETOOL64)
@$(MAKE) buildgame
german_audio: vpk/portal_sound_vo_german_dir.vpk vpk/portal_sound_vo_german_000.vpk portal_pak_dir
rm -rf portal_pak_dir/locales/de/
vpk -x portal_pak_dir/locales/de/ vpk/portal_sound_vo_german_dir.vpk
cp portal_pak_dir/sound/vo/aperture_ai/ding*.wav portal_pak_dir/locales/de/sound/vo/aperture_ai/
cd portal_pak_dir/locales/de/sound/vo/aperture_ai/; ls | xargs -I {} mv {} german_{}
rm -rf assets/locales/de/sound/vo/aperture_ai/
@mkdir -p assets/locales/de/sound/vo/aperture_ai/
cp assets/sound/vo/aperture_ai/*.sox assets/locales/de/sound/vo/aperture_ai/
cd assets/locales/de/sound/vo/aperture_ai/; ls | xargs -I {} mv {} german_{}
french_audio: vpk/portal_sound_vo_french_dir.vpk vpk/portal_sound_vo_french_000.vpk portal_pak_dir
rm -rf portal_pak_dir/locales/fr/
vpk -x portal_pak_dir/locales/fr/ vpk/portal_sound_vo_french_dir.vpk
cp portal_pak_dir/sound/vo/aperture_ai/ding*.wav portal_pak_dir/locales/fr/sound/vo/aperture_ai/
cd portal_pak_dir/locales/fr/sound/vo/aperture_ai/; ls | xargs -I {} mv {} french_{}
rm -rf assets/locales/fr/sound/vo/aperture_ai/
@mkdir -p assets/locales/fr/sound/vo/aperture_ai/
cp assets/sound/vo/aperture_ai/*.sox assets/locales/fr/sound/vo/aperture_ai/
cd assets/locales/fr/sound/vo/aperture_ai/; ls | xargs -I {} mv {} french_{}
russian_audio: vpk/portal_sound_vo_russian_dir.vpk vpk/portal_sound_vo_russian_000.vpk portal_pak_dir
rm -rf portal_pak_dir/locales/ru/
vpk -x portal_pak_dir/locales/ru/ vpk/portal_sound_vo_russian_dir.vpk
cp portal_pak_dir/sound/vo/aperture_ai/ding*.wav portal_pak_dir/locales/ru/sound/vo/aperture_ai/
cd portal_pak_dir/locales/ru/sound/vo/aperture_ai/; ls | xargs -I {} mv {} russian_{}
rm -rf assets/locales/ru/sound/vo/aperture_ai/
@mkdir -p assets/locales/ru/sound/vo/aperture_ai/
cp assets/sound/vo/aperture_ai/*.sox assets/locales/ru/sound/vo/aperture_ai/
cd assets/locales/ru/sound/vo/aperture_ai/; ls | xargs -I {} mv {} russian_{}
spanish_audio: vpk/portal_sound_vo_spanish_dir.vpk vpk/portal_sound_vo_spanish_000.vpk portal_pak_dir
rm -rf portal_pak_dir/locales/es/
vpk -x portal_pak_dir/locales/es/ vpk/portal_sound_vo_spanish_dir.vpk
cp portal_pak_dir/sound/vo/aperture_ai/ding*.wav portal_pak_dir/locales/es/sound/vo/aperture_ai/
cd portal_pak_dir/locales/es/sound/vo/aperture_ai/; ls | xargs -I {} mv {} spanish_{}
rm -rf assets/locales/es/sound/vo/aperture_ai/
@mkdir -p assets/locales/es/sound/vo/aperture_ai/
cp assets/sound/vo/aperture_ai/*.sox assets/locales/es/sound/vo/aperture_ai/
cd assets/locales/es/sound/vo/aperture_ai/; ls | xargs -I {} mv {} spanish_{}
german_audio_only: vpk/portal_sound_vo_german_dir.vpk vpk/portal_sound_vo_german_000.vpk build/src/audio/subtitles.h portal_pak_dir $(SKELATOOL64)
rm -rf portal_pak_dir/locales/
vpk -x portal_pak_dir/ vpk/portal_sound_vo_german_dir.vpk
@$(MAKE) -C skelatool64
@$(MAKE) buildgame
french_audio_only: vpk/portal_sound_vo_french_dir.vpk vpk/portal_sound_vo_french_000.vpk build/src/audio/subtitles.h portal_pak_dir $(SKELATOOL64)
rm -rf portal_pak_dir/locales/
vpk -x portal_pak_dir/ vpk/portal_sound_vo_french_dir.vpk
@$(MAKE) -C skelatool64
@$(MAKE) buildgame
russian_audio_only: vpk/portal_sound_vo_russian_dir.vpk vpk/portal_sound_vo_russian_000.vpk build/src/audio/subtitles.h portal_pak_dir $(SKELATOOL64)
rm -rf portal_pak_dir/locales/
vpk -x portal_pak_dir/ vpk/portal_sound_vo_russian_dir.vpk
@$(MAKE) -C skelatool64
@$(MAKE) buildgame
spanish_audio_only: vpk/portal_sound_vo_spanish_dir.vpk vpk/portal_sound_vo_spanish_000.vpk build/src/audio/subtitles.h portal_pak_dir $(SKELATOOL64)
rm -rf portal_pak_dir/locales/
vpk -x portal_pak_dir/ vpk/portal_sound_vo_spanish_dir.vpk
@$(MAKE) -C skelatool64
@$(MAKE) buildgame
buildgame: $(BASE_TARGET_NAME).z64
# Allow targets to depend on the GAME_VERSION variable via a file.
# Update the file only when it differs from the variable (triggers rebuild).
.PHONY: gameversion
build/version.txt: gameversion
ifneq ($(shell cat build/version.txt 2>/dev/null), $(GAME_VERSION))
@mkdir -p $(@D)
@echo -n $(GAME_VERSION) > $@
endif
include $(COMMONRULES)
build/%.o: %.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -MM $^ -MF "$(@:.o=.d)" -MT"$@"
$(CC) $(CFLAGS) -c -o $@ $<
build/%.o: %.s
@mkdir -p $(@D)
$(AS) -o $@ $< -DBOOT_CODE=$(BOOT_CODE)
####################
## Assets
####################
src/models/shadow_caster.h src/models/shadow_caster_geo.inc.h: assets/fbx/ShadowCaster.fbx
skeletool64 -s 100 -r 0,0,0 -n shadow_caster -o src/models/shadow_caster.h assets/fbx/ShadowCaster.fbx
src/models/ground.h src/models/ground_geo.inc.h: assets/fbx/Ground.fbx
skeletool64 -s 100 -r 0,0,0 -n ground -o src/models/ground.h assets/fbx/Ground.fbx
src/models/subject.h src/models/subject_geo.inc.h: assets/fbx/Subject.fbx
skeletool64 -s 100 -r 0,0,0 -n subject -o src/models/subject.h assets/fbx/Subject.fbx
src/models/sphere.h src/models/sphere_geo.inc.h: assets/fbx/Sphere.fbx
skeletool64 -s 100 -r 0,0,0 -n sphere -o src/models/sphere.h assets/fbx/Sphere.fbx
####################
## vpk extraction
####################
portal_pak_dir: vpk/Portal/portal/portal_pak_dir.vpk
vpk -x portal_pak_dir vpk/Portal/portal/portal_pak_dir.vpk
vpk -x portal_pak_dir vpk/Portal/hl2/hl2_sound_misc_dir.vpk
vpk -x portal_pak_dir vpk/Portal/hl2/hl2_misc_dir.vpk
TEXTURE_SCRIPTS = $(shell find assets/ -type f -name '*.ims')
TEXTURE_IMAGES = $(TEXTURE_SCRIPTS:assets/%.ims=portal_pak_modified/%.png) \
portal_pak_dir/materials/signage/indicator_lights/indicator_lights_corner_floor.png
TEXTURE_VTF_SOURCES = $(TEXTURE_SCRIPTS:assets/%.ims=portal_pak_dir/%.vtf)
ALL_VTF_IMAGES = $(shell find portal_pak_dir/ -type f ! -wholename '* *' -name '*.vtf')
ALL_PNG_IMAGES = $(ALL_VTF_IMAGES:%.vtf=%.png) \
portal_pak_dir/materials/signage/signage_doorstate_on.png \
portal_pak_dir/materials/signage/indicator_lights/indicator_lights_corner_floor_on.png \
portal_pak_dir/materials/signage/indicator_lights/indicator_lights_floor_on.png
$(TEXTURE_VTF_SOURCES): portal_pak_dir
%.png: %.vtf
-$(VTF2PNG) $< $@
portal_pak_dir/materials/signage/signage_doorstate_on.png: portal_pak_dir/materials/signage/signage_doorstate.vtf
$(VTF2PNG) -f 2 $< $@
portal_pak_dir/materials/signage/indicator_lights/indicator_lights_corner_floor_on.png: portal_pak_dir/materials/signage/indicator_lights/indicator_lights_corner_floor.vtf
$(VTF2PNG) -f 2 $< $@
portal_pak_dir/materials/signage/indicator_lights/indicator_lights_floor_on.png: portal_pak_dir/materials/signage/indicator_lights/indicator_lights_floor.vtf
$(VTF2PNG) -f 2 $< $@
portal_pak_dir/materials/effects/portal_1_particle_orange.png: portal_pak_dir/materials/effects/portal_1_particle.vtf
$(VTF2PNG) -f 2 $< $@
portal_pak_dir/materials/signage/clock/countdown.png: portal_pak_dir/materials/signage/clock/countdown.vtf
$(VTF2PNG) -f 60 $< $@
portal_pak_dir/materials/signage/clock/countdown_1.png: portal_pak_dir/materials/signage/clock/countdown.vtf
$(VTF2PNG) -f 59 $< $@
portal_pak_dir/materials/signage/clock/countdown_2.png: portal_pak_dir/materials/signage/clock/countdown.vtf
$(VTF2PNG) -f 58 $< $@
portal_pak_dir/materials/signage/clock/countdown_3.png: portal_pak_dir/materials/signage/clock/countdown.vtf
$(VTF2PNG) -f 57 $< $@
portal_pak_dir/materials/signage/clock/countdown_4.png: portal_pak_dir/materials/signage/clock/countdown.vtf
$(VTF2PNG) -f 56 $< $@
portal_pak_dir/materials/signage/clock/countdown_5.png: portal_pak_dir/materials/signage/clock/countdown.vtf
$(VTF2PNG) -f 55 $< $@
portal_pak_dir/materials/signage/clock/countdown_6.png: portal_pak_dir/materials/signage/clock/countdown.vtf
$(VTF2PNG) -f 54 $< $@
portal_pak_dir/materials/signage/clock/countdown_7.png: portal_pak_dir/materials/signage/clock/countdown.vtf
$(VTF2PNG) -f 53 $< $@
portal_pak_dir/materials/signage/clock/countdown_8.png: portal_pak_dir/materials/signage/clock/countdown.vtf
$(VTF2PNG) -f 52 $< $@
portal_pak_dir/materials/signage/clock/countdown_9.png: portal_pak_dir/materials/signage/clock/countdown.vtf
$(VTF2PNG) -f 51 $< $@
portal_pak_dir/materials/signage/clock/countdown.png: portal_pak_dir/materials/signage/clock/countdown_1.png portal_pak_dir/materials/signage/clock/countdown_2.png portal_pak_dir/materials/signage/clock/countdown_3.png portal_pak_dir/materials/signage/clock/countdown_4.png portal_pak_dir/materials/signage/clock/countdown_5.png portal_pak_dir/materials/signage/clock/countdown_6.png portal_pak_dir/materials/signage/clock/countdown_7.png portal_pak_dir/materials/signage/clock/countdown_8.png portal_pak_dir/materials/signage/clock/countdown_9.png portal_pak_dir/materials/signage/clock/clock_dots.png
portal_pak_dir/materials/signage/signage_overlay_fling1.png: portal_pak_dir/materials/signage/signage_overlay_fling2.png portal_pak_dir/materials/signage/signage_overlay_dots1.png portal_pak_dir/materials/signage/signage_overlay_dots2.png portal_pak_dir/materials/signage/signage_overlay_dots3.png portal_pak_dir/materials/signage/signage_overlay_dots4.png portal_pak_dir/materials/signage/signage_overlay_toxic.png portal_pak_dir/materials/signage/signage_overlay_fountain.png
portal_pak_dir/materials/signage/signage_overlay_midair1.png: portal_pak_dir/materials/signage/signage_overlay_midair2.png
portal_pak_dir/materials/signage/signage_exit.png: portal_pak_dir/materials/signage/signage_overlay_arrow.png portal_pak_dir/materials/signage/signage_overlay_boxdispenser.png portal_pak_dir/materials/signage/signage_overlay_boxhurt.png portal_pak_dir/materials/signage/signage_overlay_energyball.png portal_pak_dir/materials/signage/signage_overlay_catcher.png portal_pak_dir/materials/signage/signage_overlay_toxic.png portal_pak_dir/materials/signage/signage_overlay_fountain.png
portal_pak_dir/materials/signage/indicator_lights/indicator_lights_floor.png: portal_pak_dir/materials/signage/indicator_lights/indicator_lights_corner_floor.png
portal_pak_dir/materials/signage/indicator_lights/indicator_lights_floor_on.png: portal_pak_dir/materials/signage/indicator_lights/indicator_lights_corner_floor_on.png
portal_pak_dir/materials/models/props/round_elevator_sheet_1.png: portal_pak_dir/materials/models/props/round_elevator_sheet_3.png
convert_all_png: $(ALL_PNG_IMAGES)
portal_pak_modified/%.png: portal_pak_dir/%.png assets/%.ims
@mkdir -p $(@D)
convert $< $(shell cat $(@:portal_pak_modified/%.png=assets/%.ims)) $@
VALVE_INTRO_VIDEO = vpk/Portal/hl2/media/valve.bik
# the macOS Portal version uses a .mov file, so if the .bik file doesn't exist, let's try that
ifeq ("$(wildcard $(VALVE_INTRO_VIDEO))","")
VALVE_INTRO_VIDEO := $(subst .bik,.mov,$(VALVE_INTRO_VIDEO))
endif
portal_pak_modified/images/valve.png portal_pak_modified/images/valve-no-logo.png:
@mkdir -p $(@D)
ffmpeg -ss 00:00:04 -i $(VALVE_INTRO_VIDEO) -frames:v 1 -q:v 2 -y portal_pak_modified/images/valve-full.png
ffmpeg -ss 00:00:01 -i $(VALVE_INTRO_VIDEO) -frames:v 1 -q:v 2 -y portal_pak_modified/images/valve-full-no-logo.png
convert portal_pak_modified/images/valve-full.png -crop 491x369+265+202 -resize 160x120 portal_pak_modified/images/valve.png
convert portal_pak_modified/images/valve-full-no-logo.png -crop 492x370+266+202 -resize 160x120 portal_pak_modified/images/valve-no-logo.png
####################
## Materials
####################
build/assets/materials/static.h build/assets/materials/static_mat.c: assets/materials/static.skm.yaml $(TEXTURE_IMAGES) $(SKELETOOL64)
@mkdir -p $(@D)
$(SKELETOOL64) --name static -m $< --material-output -o build/assets/materials/static.h
build/assets/materials/ui.h build/assets/materials/ui_mat.c: assets/materials/ui.skm.yaml $(TEXTURE_IMAGES) $(SKELETOOL64)
@mkdir -p $(@D)
$(SKELETOOL64) --name ui --default-material default_ui -m $< --material-output -o build/assets/materials/ui.h
build/assets/materials/images.h build/assets/materials/images_mat.c: assets/materials/images.skm.yaml $(TEXTURE_IMAGES) $(SKELETOOL64) portal_pak_modified/images/valve.png
@mkdir -p $(@D)
$(SKELETOOL64) --name images --default-material default_ui -m $< --material-output -o build/assets/materials/images.h
build/assets/materials/hud.h build/assets/materials/hud_mat.c: assets/materials/hud.skm.yaml $(TEXTURE_IMAGES) $(SKELETOOL64)
@mkdir -p $(@D)
$(SKELETOOL64) --name hud -m $< --material-output -o build/assets/materials/hud.h
src/levels/level_def_gen.h: build/assets/materials/static.h
build/src/scene/hud.o: build/assets/materials/hud.h build/src/audio/subtitles.h
build/src/scene/elevator.o: build/assets/models/props/round_elevator_collision.h \
build/assets/models/props/round_elevator.h \
build/assets/models/props/round_elevator_interior.h \
build/assets/materials/static.h
####################
## Models
####################
#
# Source engine scale is 64x
#
MODEL_LIST = assets/models/player/chell.blend \
assets/models/portal_gun/ball_trail.blend \
assets/models/portal_gun/v_portalgun.blend \
assets/models/portal_gun/w_portalgun.blend \
assets/models/props/round_elevator.blend \
assets/models/props/round_elevator_interior.blend \
assets/models/props/round_elevator_collision.blend \
assets/models/props/signage.blend \
assets/models/portal/portal_blue.blend \
assets/models/portal/portal_blue_filled.blend \
assets/models/portal/portal_blue_face.blend \
assets/models/portal/portal_collider.blend \
assets/models/portal/portal_collider_vertical.blend \
assets/models/portal/portal_orange.blend \
assets/models/portal/portal_orange_filled.blend \
assets/models/portal/portal_orange_face.blend \
assets/models/grav_flare.blend \
assets/models/fleck_ash2.blend
DYNAMIC_MODEL_LIST = assets/models/cube/cube.blend \
assets/models/props/autoportal_frame/autoportal_frame.blend \
assets/models/props/cylinder_test.blend \
assets/models/props/lab_chair.blend \
assets/models/props/lab_desk/lab_desk01.blend \
assets/models/props/lab_desk/lab_desk02.blend \
assets/models/props/lab_desk/lab_desk03.blend \
assets/models/props/lab_desk/lab_desk04.blend \
assets/models/props/lab_monitor.blend \
assets/models/props/radio.blend \
assets/models/signage/clock_digits.blend \
assets/models/signage/clock.blend \
assets/models/props/box_dropper_glass.blend \
assets/models/props/portal_cleanser.blend \
assets/models/props/light_rail_endcap.blend
DYNAMIC_ANIMATED_MODEL_LIST = assets/models/pedestal.blend \
assets/models/props/box_dropper.blend \
assets/models/props/button.blend \
assets/models/props/combine_ball_catcher.blend \
assets/models/props/combine_ball_launcher.blend \
assets/models/props/door_01.blend \
assets/models/props/door_02.blend \
assets/models/props/security_camera.blend \
assets/models/props/switch001.blend
ANIM_LIST = build/assets/models/pedestal_anim.o \
build/assets/models/player/chell_anim.o \
build/assets/models/portal_gun/v_portalgun_anim.o \
build/assets/models/props/box_dropper_anim.o \
build/assets/models/props/combine_ball_catcher_anim.o \
build/assets/models/props/combine_ball_launcher_anim.o \
build/assets/models/props/door_01_anim.o \
build/assets/models/props/door_02_anim.o \
build/assets/models/props/switch001_anim.o
MODEL_HEADERS = $(MODEL_LIST:%.blend=build/%.h)
MODEL_OBJECTS = $(MODEL_LIST:%.blend=build/%_geo.o) \
build/assets/models/dynamic_model_list.o \
build/assets/models/dynamic_animated_model_list.o
DYNAMIC_MODEL_HEADERS = $(DYNAMIC_MODEL_LIST:%.blend=build/%.h)
DYNAMIC_MODEL_OBJECTS = $(DYNAMIC_MODEL_LIST:%.blend=build/%_geo.o)
DYNAMIC_ANIMATED_MODEL_HEADERS = $(DYNAMIC_ANIMATED_MODEL_LIST:%.blend=build/%.h)
DYNAMIC_ANIMATED_MODEL_OBJECTS = $(DYNAMIC_ANIMATED_MODEL_LIST:%.blend=build/%_geo.o)
build/assets/models/%.h build/assets/models/%_geo.c build/assets/models/%_anim.c: build/assets/models/%.fbx assets/models/%.flags assets/materials/elevator.skm.yaml assets/materials/objects.skm.yaml assets/materials/static.skm.yaml $(TEXTURE_IMAGES) $(SKELETOOL64)
$(SKELETOOL64) --fixed-point-scale ${SCENE_SCALE} --model-scale 0.01 --name $(<:build/assets/models/%.fbx=%) $(shell cat $(<:build/assets/models/%.fbx=assets/models/%.flags)) -o $(<:%.fbx=%.h) $<
build/assets/models/player/chell.h: assets/materials/chell.skm.yaml
build/assets/models/props/combine_ball_catcher.h: assets/materials/ball_catcher.skm.yaml
build/assets/models/props/combine_ball_launcher.h: assets/materials/ball_catcher.skm.yaml
build/src/audio/soundplayer.o: build/src/audio/subtitles.h
build/src/decor/decor_object_list.o: build/assets/models/dynamic_model_list.h build/assets/materials/static.h
build/src/effects/effect_definitions.o: build/assets/materials/static.h
build/src/effects/portal_trail.o: build/assets/materials/static.h build/assets/models/portal_gun/ball_trail.h
build/src/levels/level_definition.o: build/src/audio/subtitles.h
build/src/levels/level_definition.h: build/src/audio/subtitles.h
build/src/locales/locales.o: build/src/audio/clips.h build/src/audio/languages.h
build/src/menu/controls.o: build/assets/materials/ui.h build/src/audio/clips.h build/src/audio/subtitles.h
build/src/menu/game_menu.o: build/src/audio/clips.h build/assets/materials/ui.h build/assets/materials/images.h build/assets/test_chambers/test_chamber_00/test_chamber_00.h
build/src/menu/gameplay_options.o: build/assets/materials/ui.h build/src/audio/clips.h
build/src/menu/joystick_options.o: build/assets/materials/ui.h build/src/audio/clips.h
build/src/menu/landing_menu.o: build/assets/materials/ui.h build/src/audio/clips.h build/version.txt
build/src/menu/load_game.o: build/assets/materials/ui.h build/src/audio/clips.h build/src/audio/subtitles.h
build/src/menu/main_menu.o: build/src/audio/clips.h build/assets/materials/ui.h build/assets/materials/images.h build/assets/test_chambers/test_chamber_00/test_chamber_00.h
build/src/menu/new_game_menu.o: build/src/audio/clips.h build/assets/materials/ui.h build/assets/materials/images.h build/src/audio/subtitles.h build/assets/test_chambers/test_chamber_00/test_chamber_00.h
build/src/menu/options_menu.o: build/assets/materials/ui.h build/src/audio/clips.h build/src/audio/subtitles.h
build/src/menu/save_game_menu.o: build/src/audio/clips.h build/src/audio/subtitles.h
build/src/menu/text_manipulation.o: build/src/audio/subtitles.h
build/src/scene/scene_animator.o: build/src/audio/clips.h
build/src/menu/cheat_codes.o: build/src/audio/clips.h
build/src/levels/intro.o: build/src/audio/clips.h build/assets/materials/images.h
build/src/levels/credits.o: build/src/audio/clips.h build/assets/materials/ui.h
build/src/menu/savefile_list.o: build/assets/materials/ui.h build/src/audio/clips.h
build/src/font/dejavu_sans_images.o: build/assets/materials/ui.h
build/src/font/liberation_mono_images.o: build/assets/materials/ui.h
build/src/player/player.o: build/assets/models/player/chell.h build/assets/materials/static.h build/src/audio/subtitles.h
build/src/scene/ball_catcher.o: build/assets/models/props/combine_ball_catcher.h build/assets/materials/static.h build/assets/models/dynamic_animated_model_list.h
build/src/scene/ball_launcher.o: build/assets/models/props/combine_ball_launcher.h build/assets/materials/static.h build/assets/models/dynamic_animated_model_list.h
build/src/scene/ball.o: build/assets/models/grav_flare.h build/assets/models/fleck_ash2.h build/assets/materials/static.h
build/src/scene/box_dropper.o: build/assets/materials/static.h build/assets/models/props/box_dropper.h build/assets/models/dynamic_model_list.h build/assets/models/dynamic_animated_model_list.h
build/src/scene/button.o: build/assets/materials/static.h build/assets/models/props/button.h build/assets/models/dynamic_animated_model_list.h
build/src/scene/clock.o: build/assets/models/dynamic_model_list.h
build/src/scene/door.o: build/assets/materials/static.h build/assets/models/props/door_01.h build/assets/models/props/door_02.h build/assets/models/dynamic_animated_model_list.h
build/src/scene/fizzler.o: build/assets/models/dynamic_model_list.h
build/src/scene/pedestal.o: build/assets/materials/static.h build/assets/models/pedestal.h build/assets/models/dynamic_animated_model_list.h build/assets/models/portal_gun/w_portalgun.h
build/src/scene/portal_gun.o: build/assets/materials/static.h $(MODEL_HEADERS)
build/src/scene/portal_render.o: $(MODEL_HEADERS)
build/src/scene/portal.o: $(MODEL_HEADERS)
build/src/scene/render_plan.o: $(MODEL_HEADERS)
build/src/scene/security_camera.o: build/src/audio/clips.h build/assets/models/props/security_camera.h build/assets/models/dynamic_animated_model_list.h
build/src/scene/signage.o: $(MODEL_HEADERS)
build/src/scene/switch.o: build/assets/models/props/switch001.h build/assets/materials/static.h build/assets/models/dynamic_animated_model_list.h
build/src/util/dynamic_asset_loader.o: build/assets/models/dynamic_model_list.h build/assets/models/dynamic_animated_model_list.h
build/src/menu/audio_options.o: build/src/audio/subtitles.h
build/src/menu/video_options.o: build/src/audio/subtitles.h
build/src/scene/scene.o: build/src/audio/subtitles.h build/src/audio/clips.h
build/src/menu/main_menu.o: build/src/audio/subtitles.h
ANIM_TEST_CHAMBERS = build/assets/test_chambers/test_chamber_00/test_chamber_00_anim.o \
build/assets/test_chambers/test_chamber_03/test_chamber_03_anim.o \
build/assets/test_chambers/test_chamber_04/test_chamber_04_anim.o \
build/assets/test_chambers/test_chamber_06/test_chamber_06_anim.o \
build/assets/test_chambers/test_chamber_07/test_chamber_07_anim.o \
build/assets/test_chambers/test_chamber_08/test_chamber_08_anim.o \
build/assets/test_chambers/test_chamber_09/test_chamber_09_anim.o \
build/assets/test_chambers/test_chamber_10/test_chamber_10_anim.o
build/anims.ld: $(ANIM_LIST) $(ANIM_TEST_CHAMBERS) tools/generate_segment_ld.js
@mkdir -p $(@D)
node tools/generate_segment_ld.js --single-segment-name animation_segment $@ 0x0D000000 $(ANIM_LIST) $(ANIM_TEST_CHAMBERS)
####################
## Test Chambers
####################
TEST_CHAMBERS = assets/test_chambers/test_chamber_00/test_chamber_00.blend \
assets/test_chambers/test_chamber_01/test_chamber_01.blend \
assets/test_chambers/test_chamber_02/test_chamber_02.blend \
assets/test_chambers/test_chamber_03/test_chamber_03.blend \
assets/test_chambers/test_chamber_04/test_chamber_04.blend \
assets/test_chambers/test_chamber_05/test_chamber_05.blend \
assets/test_chambers/test_chamber_06/test_chamber_06.blend \
assets/test_chambers/test_chamber_07/test_chamber_07.blend \
assets/test_chambers/test_chamber_08/test_chamber_08.blend \
assets/test_chambers/test_chamber_09/test_chamber_09.blend \
assets/test_chambers/test_chamber_10/test_chamber_10.blend
TEST_CHAMBER_HEADERS = $(TEST_CHAMBERS:%.blend=build/%.h)
TEST_CHAMBER_OBJECTS = $(TEST_CHAMBERS:%.blend=build/%_geo.o)
LUA_FILES = $(shell find tools/ -type f -name '*.lua')
build/%.fbx: %.blend
@mkdir -p $(@D)
$(BLENDER_3_6) $< --background --python tools/models/export_fbx.py -- $@
build/assets/test_chambers/%.h build/assets/test_chambers/%_geo.c build/assets/test_chambers/%_anim.c: build/assets/test_chambers/%.fbx assets/test_chambers/%.yaml build/assets/materials/static.h build/src/audio/subtitles.h $(SKELETOOL64) $(TEXTURE_IMAGES) $(LUA_FILES)
$(SKELETOOL64) --script tools/level_scripts/export_level.lua --fixed-point-scale ${SCENE_SCALE} --model-scale 0.01 --name $(<:build/assets/test_chambers/%.fbx=%) -m assets/materials/static.skm.yaml -o $(<:%.fbx=%.h) $<
build/assets/test_chambers/%.o: build/assets/test_chambers/%.c build/assets/materials/static.h
@mkdir -p $(@D)
$(CC) $(CFLAGS) -MM $^ -MF "$(@:.o=.d)" -MT"$@"
$(CC) $(CFLAGS) -c -o $@ $<
build/assets/materials/%_mat.o: build/assets/materials/%_mat.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -MM $^ -MF "$(@:.o=.d)" -MT"$@"
$(CC) $(CFLAGS) -c -o $@ $<
levels: $(TEST_CHAMBER_HEADERS)
echo $(TEST_CHAMBER_HEADERS)
build/assets/test_chambers/level_list.h: $(TEST_CHAMBER_HEADERS) tools/models/generate_level_list.js tools/models/model_list_utils.js
@mkdir -p $(@D)
node tools/models/generate_level_list.js $@ $(TEST_CHAMBER_HEADERS)
build/assets/models/dynamic_model_list.h build/assets/models/dynamic_model_list.c: $(DYNAMIC_MODEL_HEADERS) tools/models/generate_dynamic_model_list.js tools/models/model_list_utils.js build/assets/models/cube/cube.h
@mkdir -p $(@D)
node tools/models/generate_dynamic_model_list.js build/assets/models/dynamic_model_list.h $(DYNAMIC_MODEL_HEADERS)
build/assets/models/dynamic_animated_model_list.h build/assets/models/dynamic_animated_model_list.c: $(DYNAMIC_ANIMATED_MODEL_HEADERS) tools/models/generate_dynamic_animated_model_list.js tools/models/model_list_utils.js
@mkdir -p $(@D)
node tools/models/generate_dynamic_animated_model_list.js build/assets/models/dynamic_animated_model_list.h $(DYNAMIC_ANIMATED_MODEL_HEADERS)
build/levels.ld: $(TEST_CHAMBER_OBJECTS) tools/generate_segment_ld.js
@mkdir -p $(@D)
node tools/generate_segment_ld.js $@ 0x02000000 $(TEST_CHAMBER_OBJECTS)
build/dynamic_models.ld: $(DYNAMIC_MODEL_OBJECTS) $(DYNAMIC_ANIMATED_MODEL_OBJECTS) tools/generate_segment_ld.js
@mkdir -p $(@D)
node tools/generate_segment_ld.js $@ 0x03000000 $(DYNAMIC_MODEL_OBJECTS) $(DYNAMIC_ANIMATED_MODEL_OBJECTS)
build/src/levels/levels.o: build/assets/test_chambers/level_list.h build/assets/materials/static.h
.PHONY: levels
####################
## Sounds
####################
SOUND_ATTRIBUTES = $(shell find assets/ -type f -name '*.sox')
SOUND_JATTRIBUTES = $(shell find assets/ -type f -name '*.jsox')
MUSIC_ATTRIBUTES = $(shell find assets/sound/music/ -type f -name '*.msox')
INS_SOUNDS = $(shell find assets/ -type f -name '*.ins')
SOUND_CLIPS = $(SOUND_ATTRIBUTES:%.sox=build/%.aifc) $(SOUND_JATTRIBUTES:%.jsox=build/%.aifc) $(INS_SOUNDS) $(MUSIC_ATTRIBUTES:%.msox=build/%.aifc)
$(INS_SOUNDS): portal_pak_dir
portal_pak_dir/sound/music/%.wav: portal_pak_dir/sound/music/%.mp3
portal_pak_dir/sound/ambient/music/valve.wav:
@mkdir -p $(@D)
ffmpeg -i $(VALVE_INTRO_VIDEO) -vn -y $@
build/assets/sound/vehicles/tank_turret_loop1.wav: portal_pak_dir
@mkdir -p $(@D)
sox portal_pak_dir/sound/vehicles/tank_turret_loop1.wav -b 16 $@
build/assets/sound/ambient/atmosphere/ambience_base.wav: portal_pak_dir
@mkdir -p $(@D)
sox portal_pak_dir/sound/ambient/atmosphere/ambience_base.wav -c 1 -r 22050 $@
build/assets/%.aifc: assets/%.sox portal_pak_dir/%.wav
@mkdir -p $(@D)
sox $(<:assets/%.sox=portal_pak_dir/%.wav) $(shell cat $<) $(@:%.aifc=%.wav)
$(SFZ2N64) -o $@ $(@:%.aifc=%.wav)
build/assets/%.aifc: assets/%.jsox tools/sound/jsox.js portal_pak_dir/%.wav
@mkdir -p $(@D)
node tools/sound/jsox.js sox $< $(<:assets/%.jsox=portal_pak_dir/%.wav) $(@:%.aifc=%.wav)
$(SFZ2N64) -o $@ $(@:%.aifc=%.wav)
build/assets/%.aifc: assets/%.msox portal_pak_dir/%.mp3
@mkdir -p $(@D)
ffmpeg -y -i $(<:assets/%.msox=portal_pak_dir/%.mp3) $(<:assets/%.msox=portal_pak_dir/%.wav)
sox $(<:assets/%.msox=portal_pak_dir/%.wav) $(shell cat $<) $(@:%.aifc=%.wav)
$(SFZ2N64) -o $@ $(@:%.aifc=%.wav)
build/assets/sound/sounds.sounds build/assets/sound/sounds.sounds.tbl: $(SOUND_CLIPS) build/assets/sound/vehicles/tank_turret_loop1.wav build/assets/sound/ambient/atmosphere/ambience_base.wav
@mkdir -p $(@D)
$(SFZ2N64) -o $@ $^
build/asm/sound_data.o: build/assets/sound/sounds.sounds build/assets/sound/sounds.sounds.tbl
build/src/audio/clips.h build/src/audio/languages.h build/src/audio/languages.c: tools/sound/generate_sound_ids.js $(SOUND_CLIPS)
@mkdir -p $(@D)
node tools/sound/generate_sound_ids.js --makefile-hack --out-dir $(@D) $(SOUND_CLIPS)
build/src/audio/clips.o: build/src/audio/clips.h
build/src/decor/decor_object_list.o: build/src/audio/clips.h
####################
## Fonts
####################
FONT_SOURCES = build/assets/fonts/dejavu_sans.c \
build/assets/fonts/liberation_mono.c
FONT_OBJECTS = $(patsubst %.c, %.o, $(FONT_SOURCES))
DEJAVU_SANS_JSON = $(shell find assets/fonts/dejavu_sans/ -type f -name 'dejavu_sans*.json')
LIBERATION_MONO_JSON = $(shell find assets/fonts/liberation_mono/ -type f -name 'liberation_mono*.json')
build/assets/fonts/dejavu_sans.c: tools/text/font_converter.js $(DEJAVU_SANS_JSON)
@mkdir -p $(@D)
node tools/text/font_converter.js DejaVuSans assets/fonts/dejavu_sans/ $@
build/assets/fonts/liberation_mono.c: tools/text/font_converter.js $(LIBERATION_MONO_JSON)
@mkdir -p $(@D)
node tools/text/font_converter.js LiberationMono assets/fonts/liberation_mono/ $@
####################
## Subtitles
####################
SUBTITLE_SOURCES = $(shell find build/src/audio/ -type f -name 'subtitles_*.c')
SUBTITLE_OBJECTS = $(patsubst %.c, %.o, $(SUBTITLE_SOURCES))
build/src/audio/subtitles_%.o: build/src/audio/subtitles_%.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -MM $^ -MF "$(@:.o=.d)" -MT"$@"
$(CC) $(CFLAGS) -c -o $@ $<
build/src/audio/subtitles.h build/src/audio/subtitles.c: vpk/Portal/portal/resource/closecaption_english.txt vpk/Portal/hl2/resource/gameui_english.txt vpk/Portal/hl2/resource/valve_english.txt assets/translations/extra_english.txt tools/text/subtitle_generate.py
python3 tools/text/subtitle_generate.py --game-root-dir vpk --extra-translations-dir assets/translations --output-dir build/src/audio
build/subtitles.ld: $(SUBTITLE_OBJECTS) tools/generate_segment_ld.js
@mkdir -p $(@D)
node tools/generate_segment_ld.js --alignment 16 $@ 0x04000000 $(SUBTITLE_OBJECTS)
####################
## Linking
####################
# without debugger
CODEOBJECTS = $(patsubst %.c, build/%.o, $(CODEFILES)) \
$(MODEL_OBJECTS) \
$(FONT_OBJECTS) \
build/assets/materials/static_mat.o \
build/assets/materials/ui_mat.o \
build/assets/materials/hud_mat.o \
build/src/audio/subtitles.o \
build/src/audio/languages.o
CODEOBJECTS_NO_DEBUG = $(CODEOBJECTS)
DATA_OBJECTS = build/assets/materials/images_mat.o \
$(TEST_CHAMBER_OBJECTS) \
$(ANIM_TEST_CHAMBERS) \
$(ANIM_LIST) \
$(DYNAMIC_MODEL_OBJECTS) \
$(DYNAMIC_ANIMATED_MODEL_OBJECTS) \
$(SUBTITLE_OBJECTS)
ifeq ($(PORTAL64_WITH_DEBUGGER),1)
CODEOBJECTS_NO_DEBUG += build/debugger/debugger_stub.o build/debugger/serial_stub.o
endif
$(CODESEGMENT).no_debug.a: $(CODEOBJECTS_NO_DEBUG)
ar r $@ $^
$(CP_LD_SCRIPT).no_debug.ld: $(LD_SCRIPT) build/levels.ld build/dynamic_models.ld build/anims.ld build/subtitles.ld
cpp -P -Ibuild -Wno-trigraphs $(LCDEFS) -DRSP_BOOT=$(RSP_BOOT) -DRSP_UCODE=$(RSP_UCODE) -DASP_UCODE=$(ASP_UCODE) -o $@ $<
$(BASE_TARGET_NAME).z64: $(CODESEGMENT).no_debug.a $(ASMOBJECTS) $(DATA_OBJECTS) $(CP_LD_SCRIPT).no_debug.ld
$(LD) -L. -T $(CP_LD_SCRIPT).no_debug.ld -Map $(BASE_TARGET_NAME).no_debug.map -o $(BASE_TARGET_NAME).elf $(ASMOBJECTS) $(DATA_OBJECTS) $(CODESEGMENT).no_debug.a $(LDDIRS) $(LDFLAGS)
$(OBJCOPY) --pad-to=0x100000 --gap-fill=0xFF $(BASE_TARGET_NAME).elf $(BASE_TARGET_NAME).z64 -O binary
makemask $(BASE_TARGET_NAME).z64
sh tools/romfix64.sh $(BASE_TARGET_NAME).z64
# with debugger
CODEOBJECTS_DEBUG = $(CODEOBJECTS)
ifeq ($(PORTAL64_WITH_DEBUGGER),1)
CODEOBJECTS_DEBUG += build/debugger/debugger.o build/debugger/serial.o
endif
$(CODESEGMENT).debug.a: $(CODEOBJECTS_DEBUG)
ar r $@ $^
$(CP_LD_SCRIPT).debug.ld: $(LD_SCRIPT) build/levels.ld build/dynamic_models.ld build/anims.ld build/subtitles.ld
cpp -P -Ibuild -Wno-trigraphs $(LCDEFS) -DRSP_BOOT=$(RSP_BOOT) -DRSP_UCODE=$(RSP_UCODE) -DASP_UCODE=$(ASP_UCODE) -o $@ $<
$(BASE_TARGET_NAME).debug.z64: $(CODESEGMENT).debug.a $(ASMOBJECTS) $(DATA_OBJECTS) $(CP_LD_SCRIPT).debug.ld
$(LD) -L. -T $(CP_LD_SCRIPT).debug.ld -Map $(BASE_TARGET_NAME).debug.map -o $(BASE_TARGET_NAME).elf $(ASMOBJECTS) $(DATA_OBJECTS) $(CODESEGMENT).debug.a $(LDDIRS) $(LDFLAGS)
$(OBJCOPY) --pad-to=0x100000 --gap-fill=0xFF $(BASE_TARGET_NAME)_debug.elf $(BASE_TARGET_NAME)_debug.z64 -O binary
makemask $(BASE_TARGET_NAME)_debug.z64
sh tools/romfix64.sh $(BASE_TARGET_NAME).z64
clean:
rm -rf build
rm -rf portal_pak_dir
rm -rf portal_pak_modified
rm -rf assets/locales
cmake --build skeletool64/build --target clean
clean-src:
rm -rf build/src
rm -f $(CODESEGMENT).debug.a
rm -f $(CODESEGMENT).no_debug.a
rm -f $(BASE_TARGET_NAME)_debug.elf
rm -f $(BASE_TARGET_NAME).elf
rm -f $(BASE_TARGET_NAME).z64
rm -f $(BASE_TARGET_NAME)_debug.z64
clean-assets:
rm -rf build/assets
rm -rf assets/locales/
rm -f $(CODESEGMENT).debug.a
rm -f $(CODESEGMENT).no_debug.a
rm -f $(BASE_TARGET_NAME)_debug.elf
rm -f $(BASE_TARGET_NAME).elf
rm -f $(BASE_TARGET_NAME).z64
rm -f $(BASE_TARGET_NAME)_debug.z64
.SECONDARY:

View File

@ -1,36 +0,0 @@
all:
docker run --rm -v $$PWD:/usr/src/app -e PORTAL64_WITH_DEBUGGER -e PORTAL64_WITH_GFX_VALIDATOR -it portal64 make
convert_all_png:
docker run --rm -v $$PWD:/usr/src/app -e PORTAL64_WITH_DEBUGGER -e PORTAL64_WITH_GFX_VALIDATOR -it portal64 make convert_all_png
image:
docker build -t portal64 .
bash:
docker run --rm -v $$PWD:/usr/src/app -e PORTAL64_WITH_DEBUGGER -e PORTAL64_WITH_GFX_VALIDATOR -it portal64 bash
clean:
sudo rm -rf build
sudo rm -rf portal_pak_dir
sudo rm -rf portal_pak_modified
sudo rm -rf assets/locales
sudo $(MAKE) -C skeletool64 clean
english_audio:
docker run --rm -v $$PWD:/usr/src/app -e PORTAL64_WITH_DEBUGGER -e PORTAL64_WITH_GFX_VALIDATOR -it portal64 make english_audio
all_languages:
docker run --rm -v $$PWD:/usr/src/app -e PORTAL64_WITH_DEBUGGER -e PORTAL64_WITH_GFX_VALIDATOR -it portal64 make all_languages
german_audio:
docker run --rm -v $$PWD:/usr/src/app -e PORTAL64_WITH_DEBUGGER -e PORTAL64_WITH_GFX_VALIDATOR -it portal64 make german_audio
french_audio:
docker run --rm -v $$PWD:/usr/src/app -e PORTAL64_WITH_DEBUGGER -e PORTAL64_WITH_GFX_VALIDATOR -it portal64 make french_audio
russian_audio:
docker run --rm -v $$PWD:/usr/src/app -e PORTAL64_WITH_DEBUGGER -e PORTAL64_WITH_GFX_VALIDATOR -it portal64 make russian_audio
spanish_audio:
docker run --rm -v $$PWD:/usr/src/app -e PORTAL64_WITH_DEBUGGER -e PORTAL64_WITH_GFX_VALIDATOR -it portal64 make spanish_audio

View File

@ -44,42 +44,30 @@ This is a community driven project that welcomes any and all game testers and or
## How to build ## How to build
Clone the Portal64 repo or download the zip. ### Get the Code
First, clone the repository or download a source code archive.
```sh ```sh
sudo apt install git -y
git clone https://github.com/mwpenny/portal64-still-alive.git portal64 git clone https://github.com/mwpenny/portal64-still-alive.git portal64
cd portal64
``` ```
### Setup and install dependencies ### Provide Game Files
The following commands allow the scripts to run on the system, then it runs the setup. You must provide your own legally obtained Portal game files so the game assets
can be extracted and used. Follow the instructions at
[vpk/README.md](./vpk/README.md).
As always it is good practice look over scripts from the internet before running them on your system. ### Install Dependencies
```sh Next, install the dependencies. There are two supported ways to do this:
sudo chmod +x tools/romfix64.sh
sudo chmod +x tools/setup.sh
./tools/setup.sh
```
Alternative setup methods include [Docker setup](./documentation/docker_setup.md) and [Manual setup](./documentation/manual_setup.md). * [Use Docker](./documentation/building/docker_setup.md). This is recommended if
you don't want to make system-wide changes or are unfamiliar with Linux.
* [Install natively](./documentation/building/native_setup.md). This is also
applicable if using a virtual machine or Windows Subsystem for Linux (WSL).
Whatever setup you choose, you will still need to add the Portal folder to `portal64/vpk/` OR create a symbolic link to the Portal folder. See [vpk/add_vpk_here.md](./vpk/add_vpk_here.md) for more details! Symlinks do not work for Docker builds. ### Build the Game
### Build ROM With everything set up, follow the instructions at
[Building the Game](./documentation/building/building.md).
Finally, run (as non-root) `make` to build the project.
```sh
# Build (default build with english audio)
make
```
If you have issues use `make clean` to clean out any previous build files, remember it also removes any languages you set up so you will need to run those commands again.
```sh
# Clean out any previous build files
make clean
```

View File

@ -61,5 +61,5 @@ add_custom_target(anims_linker_script
DEPENDS ${ANIMS_LINKER_SCRIPT} DEPENDS ${ANIMS_LINKER_SCRIPT}
) )
set_target_properties(anims_linker_script PROPERTIES set_target_properties(anims_linker_script PROPERTIES
OUTPUT "${ANIMS_LINKER_SCRIPT}" SCRIPT_FILE "${ANIMS_LINKER_SCRIPT}"
) )

View File

@ -365,5 +365,5 @@ add_custom_target(models_dynamic_linker_script
DEPENDS ${DYNAMIC_MODELS_LINKER_SCRIPT} DEPENDS ${DYNAMIC_MODELS_LINKER_SCRIPT}
) )
set_target_properties(models_dynamic_linker_script PROPERTIES set_target_properties(models_dynamic_linker_script PROPERTIES
OUTPUT "${DYNAMIC_MODELS_LINKER_SCRIPT}" SCRIPT_FILE "${DYNAMIC_MODELS_LINKER_SCRIPT}"
) )

View File

@ -242,5 +242,5 @@ add_custom_target(level_linker_script
DEPENDS ${LEVEL_LINKER_SCRIPT} DEPENDS ${LEVEL_LINKER_SCRIPT}
) )
set_target_properties(level_linker_script PROPERTIES set_target_properties(level_linker_script PROPERTIES
OUTPUT "${LEVEL_LINKER_SCRIPT}" SCRIPT_FILE "${LEVEL_LINKER_SCRIPT}"
) )

View File

@ -91,5 +91,5 @@ add_custom_target(string_linker_script
DEPENDS ${STRING_LINKER_SCRIPT} DEPENDS ${STRING_LINKER_SCRIPT}
) )
set_target_properties(string_linker_script PROPERTIES set_target_properties(string_linker_script PROPERTIES
OUTPUT "${STRING_LINKER_SCRIPT}" SCRIPT_FILE "${STRING_LINKER_SCRIPT}"
) )

View File

@ -17,6 +17,10 @@ function(add_external_project_executable PROJECT_NAME)
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}"
CMAKE_ARGS CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>" "-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>"
BUILD_COMMAND
${CMAKE_COMMAND} --build <BINARY_DIR> --config Release
INSTALL_COMMAND
${CMAKE_COMMAND} --install <BINARY_DIR> --config Release
BUILD_BYPRODUCTS BUILD_BYPRODUCTS
# Needed for Ninja so we can depend on the executable before it exists # Needed for Ninja so we can depend on the executable before it exists
"<INSTALL_DIR>/${RELATIVE_EXE_PATH}" "<INSTALL_DIR>/${RELATIVE_EXE_PATH}"

View File

@ -38,4 +38,7 @@ if (Libgcc_FOUND AND NOT TARGET libgcc::libgcc)
set_target_properties(libgcc::libgcc PROPERTIES set_target_properties(libgcc::libgcc PROPERTIES
IMPORTED_LOCATION ${Libgcc_LIBRARY} IMPORTED_LOCATION ${Libgcc_LIBRARY}
) )
# Don't clutter GUI on success
mark_as_advanced(Libgcc_LIBRARY)
endif() endif()

View File

@ -4,8 +4,8 @@
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
set(LIBULTRA_BOOT_CODE "6102" CACHE PATH "Boot code to use") set(LIBULTRA_BOOT_CODE "6102" CACHE STRING "Boot code to use")
set(LIBULTRA_RSP_UCODE "gspF3DEX2.fifo" CACHE PATH "RSP microcode to use") set(LIBULTRA_RSP_UCODE "gspF3DEX2.fifo" CACHE STRING "RSP microcode to use")
find_path (Libultra_INCLUDE_DIR ultra64.h PATH_SUFFIXES "n64") find_path (Libultra_INCLUDE_DIR ultra64.h PATH_SUFFIXES "n64")
find_library(Libultra_LIBRARY ultra_rom PATH_SUFFIXES "n64") find_library(Libultra_LIBRARY ultra_rom PATH_SUFFIXES "n64")
@ -24,6 +24,7 @@ find_package_handle_standard_args(Libultra
REQUIRED_VARS REQUIRED_VARS
Libultra_INCLUDE_DIR Libultra_INCLUDE_DIR
Libultra_LIBRARY Libultra_LIBRARY
Libultra_BOOT
Libultra_RSP_BOOT Libultra_RSP_BOOT
Libultra_RSP_UCODE Libultra_RSP_UCODE
Libultra_ASP_UCODE Libultra_ASP_UCODE
@ -47,4 +48,17 @@ if (Libultra_FOUND AND NOT TARGET libultra::libultra)
target_link_libraries(libultra::libultra INTERFACE target_link_libraries(libultra::libultra INTERFACE
libgcc::libgcc libgcc::libgcc
) )
# Don't clutter GUI on success
mark_as_advanced(
LIBULTRA_BOOT_CODE
LIBULTRA_RSP_UCODE
Libultra_INCLUDE_DIR
Libultra_LIBRARY
Libultra_BOOT
Libultra_RSP_BOOT
Libultra_RSP_UCODE
Libultra_ASP_UCODE
)
endif() endif()

View File

@ -5,8 +5,8 @@
set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_NAME Generic)
set(N64 TRUE) set(N64 TRUE)
set(N64_TOOLCHAIN_ROOT "" CACHE PATH "Root directory of N64 toolchain") set(N64_TOOLCHAIN_ROOT "" CACHE PATH "Root directory of N64 toolchain")
set(N64_TOOLCHAIN_PREFIX "mips64-elf-" CACHE STRING "File name prefix for toolchain programs") set(N64_TOOLCHAIN_PREFIX "mips-n64-" CACHE STRING "File name prefix for toolchain programs")
# Ensure CMake can find toolchain during compiler tests # Ensure CMake can find toolchain during compiler tests
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
@ -15,6 +15,7 @@ list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
) )
list(APPEND CMAKE_PREFIX_PATH list(APPEND CMAKE_PREFIX_PATH
"/"
"/usr" "/usr"
) )
@ -53,18 +54,35 @@ set(BUILD_TYPES
foreach(LANG ASM C CXX) foreach(LANG ASM C CXX)
foreach(TYPE ${BUILD_TYPES}) foreach(TYPE ${BUILD_TYPES})
string(TOUPPER ${TYPE} TYPE_UPPER) string(TOUPPER ${TYPE} TYPE_UPPER)
set("CMAKE_${LANG}_FLAGS_${TYPE_UPPER}" ${COMPILE_FLAGS_${TYPE_UPPER}}) set(FLAG_VAR "CMAKE_${LANG}_FLAGS_${TYPE_UPPER}")
set(${FLAG_VAR} ${COMPILE_FLAGS_${TYPE_UPPER}} CACHE STRING "${TYPE} flags")
mark_as_advanced(${FLAG_VAR})
endforeach() endforeach()
endforeach() endforeach()
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (IS_MULTI_CONFIG) if (IS_MULTI_CONFIG)
set(CMAKE_CONFIGURATION_TYPES ${BUILD_TYPES}) set(CMAKE_CONFIGURATION_TYPES ${BUILD_TYPES} CACHE STRING "Supported build types" FORCE)
mark_as_advanced(CMAKE_CONFIGURATION_TYPES)
else() else()
set(CMAKE_BUILD_TYPE "DebugOptimized" CACHE STRING "Project build type") set(CMAKE_BUILD_TYPE "DebugOptimized" CACHE STRING "Project build type")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${BUILD_TYPES}) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${BUILD_TYPES})
endif() endif()
# Don't clutter GUI on success
mark_as_advanced(
N64_TOOLCHAIN_ROOT
N64_TOOLCHAIN_PREFIX
CMAKE_ASM_COMPILER
CMAKE_C_COMPILER
CMAKE_CPP
CMAKE_CXX_COMPILER
CMAKE_OBJCOPY
Makemask_EXECUTABLE
)
# ROM generation # ROM generation
function(target_linker_script TARGET SCRIPT_FILE) function(target_linker_script TARGET SCRIPT_FILE)

View File

@ -0,0 +1,118 @@
# Building the Game
> **Note:** Make sure you have
> [copied your Portal game files](../../vpk/README.md) and
> set up the project dependencies either
> [using Docker](./docker_setup.md) or [natively](./native_setup.md).
This project is built using [CMake](https://cmake.org/cmake/help/). CMake works
in two main phases: **configuration** and **building**.
CMake supports multiple different target build systems. Configuration time is
when build system files are generated. For example, Makefiles or `.ninja` files.
Configuration only needs to happen when first setting up the project or when
changing build-related settings.
Build time is when the code is actually compiled/linked. This amounts to running
the build tool corresponding to the files CMake previously generated at
configuration time (`make`, `ninja`, etc.).
## Configuration
Configure the build system with the following command. Portal 64 is
cross-compiled for the N64, and so a toolchain file must be specified.
**Note:** Currently, the build directory must be named `build`.
```sh
cd portal64
cmake -G "Ninja" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-N64.cmake
```
### Changing the CMake Generator
The default CMake generator is system dependent. We specify an exact generator
with the `-G` argument for consistency across platforms. Ninja is recommended
due to its speed. You may need to install it. For example, on Debian/Ubuntu:
```sh
apt install ninja-build
```
Alternatively, use "Unix Makefiles" in the configuration command instead of
"Ninja" to use `make`.
### Manually Specifying Missing Dependencies
CMake will try to automatically locate dependencies on your system. If programs
or directories cannot be found during configuration then you can explicitly
assign values to relevant variables (mentioned in error messages) using the `-D`
argument. For example:
```sh
cd portal64
# Replace <build_directory> with build directory name
cmake -DBlender_EXECUTABLE=/path/to/blender <build_directory>
```
This should not be necessary if you followed the dependency setup steps, but is
useful to know in case of issues or if using a different build environment than
these documents.
## Build
Once the build system has been configured, build the game with one of the
following commands. From this point forward only build commands are needed.
```sh
cd portal64
# Generator independent
# Replace <build_directory> with build directory name
cmake --build <build_directory>
```
or
```sh
# Replace <build_directory> with build directory name
cd portal64/<build_directory>
# If using ninja
ninja
# If using make
make
```
## Optional Settings
There are several settings you can change which affect the build. Most notably:
| Name | Type | Description |
| ----------------- | -------------------- | --- |
| `AUDIO_LANGUAGES` | Comma-separated list | Specify which audio languages to include. Supported values are any combination of `english`, `french`, `german`, `russian`, or `spanish` - or just `all`, to include everything. Ensure relevant audio VPKs have been copied (see [vpk/README.md](../../vpk/README.md#add-multiple-audio-languages)). Only English audio is included by default. |
| `TEXT_LANGUAGES` | Comma-separated list | Specify which text languages to include. Supported values are any combination of `english`, `brazilian`, `bulgarian`, `czech`, `danish`, `german`, `spanish`, `latam`, `greek`, `french`, `italian`, `polish`, `hungarian`, `dutch`, `norwegian`, `portuguese`, `russian`, `romanian`, `finnish`, `swedish`, `turkish`, or `ukrainian` - or just `all`, to include everything. All supported text languages are included by default. |
| `DEBUGGER` | Boolean | Build with support for hardware debugging. See [debugger.md](../debugger.md) for more information. Defaults to `OFF`. |
| `GFX_VALIDATOR` | Boolean | Build with display list validator. Defaults to `OFF`. |
| `RSP_PROFILER` | Boolean | Build with RSP performance profiler. Defaults to `OFF`. |
You can see a list of all project CMake variables using the following commands.
```sh
# Standard variables
cmake -LH build
# Standard and advanced variables
cmake -LAH build
```
Update a variable using the following command, then build again.
```sh
cd portal64
# Replace <build_directory> with build directory name
cmake -DVARIABLE_NAME=value <build_directory>
```

View File

@ -0,0 +1,64 @@
# Docker Build Setup
This project provides a Docker image for easy and consistent builds regardless
of platform. This is the recommended setup if you don't want to make system-wide
changes just for this project, or are unfamiliar with Linux.
## Install Docker
Install Docker either by using your package manager or by following the
instructions at https://docs.docker.com/engine/install/.
For example, on Ubuntu:
```sh
sudo apt install docker.io
```
If installing from docker.com, Docker Desktop is not required -- only Docker
Engine.
## Build Docker Image
Build the Docker image with the following command. This will create an image
tagged with the name "portal64" containing all project dependencies.
```sh
cd portal64
docker build -t portal64 .
```
## File Permissions
If you run Docker as root you may want to change the permissions of the
`portal_pak_dir/`, `portal_pak_modified/`, and build output directories to be
able to edit them outside of the container (they will be owned by root). On
Linux, you can use the following commands.
```sh
# Replace <build_directory> with build directory name
sudo chmod 777 -R portal_pak_dir
sudo chmod 777 -R portal_pak_modified
sudo chmod 777 -R <build_directory>
```
## Running Commands in the Container
Once the Docker image is built, use the following command to launch a container
and access an interactive shell.
```sh
cd portal64
docker run --rm -v .:/usr/src/app -it portal64 bash
```
This mounts the current directory (the project root) inside the container at
`/usr/src/app` (so the build can read the project and game files) and runs
`bash` to provide a shell.
## Building the Code
From here, all build commands are the same as a native build. Follow the
[build instructions](./building.md) as normal making sure to run the commands
in the container. You can exit by using the `exit` command, after which the
container will be removed.

View File

@ -0,0 +1,72 @@
# Native Build Setup
These steps will install and configure the project dependencies system-wide.
You can also follow the same steps to set up the dependencies in a virtual
machine or using Windows Subsystem for Linux (WSL). Follow them manually, or
execute the [tools/setup_ubuntu.sh](../../tools/setup_ubuntu.sh) script.
> **Note:** The steps and commands below assume you are using Ubuntu Linux or
a similar Debian derivative. Building in other environments is possible but
considered advanced -- you should know what you're doing if trying something
different. Otherwise, consider [using Docker](./docker_setup.md).
## SDK
First, you will need to set up
[Modern SDK](https://crashoveride95.github.io/n64hbrew/modernsdk/startoff.html).
Follow the instructions on the linked page.
## Game Dependencies
You can install most dependencies using the default Ubuntu repositories.
If using something other than `apt` or Ubuntu then package names and
availability may differ.
```sh
sudo apt install build-essential cmake ffmpeg git imagemagick nodejs pip pipx python3 sox unzip
```
For the following dependencies, first add the following custom repository.
You will need to build [sfz2n64](https://github.com/lambertjamesd/sfz2n64) and
[vtf2png](https://github.com/eXeC64/vtf2png) from source if not using Ubuntu.
```sh
echo "deb [trusted=yes] https://lambertjamesd.github.io/apt/ ./" \
| sudo tee /etc/apt/sources.list.d/lambertjamesd.list
sudo apt update
sudo apt install sfz2n64 vtf2png
```
Next, you will need to install Blender 3.6 LTS (the version is important; only
3.6.x will work correctly). Snap is an easy way to install a specific version.
You could alternatively download it from
[blender.org](https://download.blender.org/release/Blender3.6/) or other means,
just ensure the Blender executable directory is included in the `PATH`
environment variable so it can be found at build time.
```sh
sudo snap install blender --channel=3.6lts/stable --classic
```
Install the Python `vpk` module using `pipx`.
```sh
sudo apt install pipx
pipx ensurepath
pipx install vpk
```
## Skeletool Dependencies
Install dependencies for `skeletool64`. This tool is used to convert some game
assets.
**Note:** Lua 5.4 is required!
```sh
sudo apt install cimg-dev libassimp-dev liblua5.4-0 liblua5.4-dev libpng-dev libtiff-dev libyaml-cpp-dev lua5.4
```
## Building the Code
From here, follow the [build instructions](./building.md).

View File

@ -35,19 +35,20 @@ portal64/
validator.h validator.h
``` ```
Next, you need to configure an environment variable. Put this in your `~/.bashrc` or `~/.profile` Next, you need to configure CMake with `DEBUGGER=ON`:
``` ```sh
cd portal64
# Replace <build_directory> with build directory name
cmake -DDEBUGGER=ON <build_directory>
export PORTAL64_WITH_DEBUGGER=1 export PORTAL64_WITH_DEBUGGER=1
``` ```
Then to build the rom with the debugger in it, use ths make command Then build as normal. This will build a version of the game that has a debugger
installed. When the game boots, it will pause and wait for something to connect
``` to the debugger before continuing. To connect the debugger with an everdrive,
PORTAL64_WITH_GFX_VALIDATOR=1 make build/portal_debug.z64 you will need to run the following script.
```
This will build a version of the game that has a debugger installed. When the game boots, it will pause and wait for something to connect to the debugger before continuing. To connect the debugger with an everdrive, you will need to run the following script.
``` ```
node /path/to/libultragdb/proxy/proxy.js /dev/ttyUSB0 8080 node /path/to/libultragdb/proxy/proxy.js /dev/ttyUSB0 8080

View File

@ -1,87 +0,0 @@
## Build with Docker
If `apt install docker` doesn't work, you have to either use `apt install docker.io` or e.g. not use apt at all and install Docker "officially" from docker.com
Also, using snap to install Docker is not advised `sudo snap install docker` gives, an [Errno 13] Permission denied error message (for python3.11-minimal) and this blocks creating the Docker image.
(also, some may have to run `sudo setfacl -R -m u:$USER:rwx /var/run/docker.sock` first, if Docker wasn't installed from docker.com)
Add all desired [languages](/vpk/add_vpk_here.md) for the build process.
After that you can build the docker image using:
```sh
make -f Makefile.docker image # Builds the Docker image.
```
Then build the rom using;
```sh
make -f Makefile.docker
```
## You can also use the language options, e.g.:
```sh
make -f Makefile.docker german_audio
```
```sh
make -f Makefile.docker french_audio
```
```sh
make -f Makefile.docker russian_audio
```
```sh
make -f Makefile.docker spanish_audio
```
```sh
make -f Makefile.docker # Run this after running the commands for the desired languages that you would like to add to your ROM.
```
## Build all audio languages into the ROM.
Make sure to put all the following files in the portal64/vpk folder then run:
```sh
make -f Makefile.docker all_languages
```
If you have issues use `make -f Makefile.docker clean` to clean out any previous build files, remember it also removes any languages you set up so you will need to run those commands again.
```sh
make -f Makefile.docker clean
```
That will generate the rom at `/build/portal64.z64`
If you run Docker in sudo you may want to change the permissions of portal64/build, portal64/portal_pak_dir and portal64portal_pak_modified:
```sh
sudo chmod 777 -R build
sudo chmod 777 -R portal_pak_dir
sudo chmod 777 -R portal_pak_modified
```

View File

@ -1,62 +0,0 @@
## How to Build
### SDK
First, you will need to setup [Modern SDK](https://crashoveride95.github.io/n64hbrew/modernsdk/startoff.html).
### Game Dependencies
You can install most dependencies using your package manager's default repository:
```sh
sudo apt install build-essential cmake ffmpeg git imagemagick nodejs pip pipx python3 sox unzip
```
For the following dependencies, first add the following custom repository:
```sh
echo "deb [trusted=yes] https://lambertjamesd.github.io/apt/ ./" \
| sudo tee /etc/apt/sources.list.d/lambertjamesd.list
sudo apt update
sudo apt install sfz2n64 vtf2png
```
Next, you will need to install Blender 3.6 LTS (please don't use e.g. 4.x, only 3.6.x will work correctly). Then set the environment variable `BLENDER_3_6` to be the absolute path where the Blender 3.6 executable is located on your system.
```sh
sudo snap install blender --channel=3.6lts/stable --classic
```
E.g., add this to your `~/.bashrc` if you used snap (or you can use `which blender` to find the path of Blender 3.6):
```bash
export BLENDER_3_6="/snap/bin/blender"
```
Install the Python `vpk` module using pipx:
```sh
sudo apt install pipx
pipx ensurepath
pipx install vpk
```
### Skeletool Dependencies
Setup and install dependencies for `skeletool64`:
```sh
sudo apt install cimg-dev libassimp-dev liblua5.4-0 liblua5.4-dev libpng-dev libtiff-dev libyaml-cpp-dev lua5.4
```
**Note:** Lua 5.4 is required!
### Getting the Code
Clone the Portal64 repo or download the zip.
```sh
git clone https://github.com/mwpenny/portal64-still-alive.git portal64
cd portal64
```

View File

@ -9,10 +9,10 @@ set(OUTPUT_LINKER_SCRIPT "${LINKER_SCRIPT_DIR}/portal.ld")
add_custom_command( add_custom_command(
DEPENDS DEPENDS
${LINKER_SCRIPT} ${LINKER_SCRIPT}
anims_linker_script "$<TARGET_PROPERTY:anims_linker_script,OUTPUT>" anims_linker_script "$<TARGET_PROPERTY:anims_linker_script,SCRIPT_FILE>"
level_linker_script "$<TARGET_PROPERTY:level_linker_script,OUTPUT>" level_linker_script "$<TARGET_PROPERTY:level_linker_script,SCRIPT_FILE>"
models_dynamic_linker_script "$<TARGET_PROPERTY:models_dynamic_linker_script,OUTPUT>" models_dynamic_linker_script "$<TARGET_PROPERTY:models_dynamic_linker_script,SCRIPT_FILE>"
string_linker_script "$<TARGET_PROPERTY:string_linker_script,OUTPUT>" string_linker_script "$<TARGET_PROPERTY:string_linker_script,SCRIPT_FILE>"
OUTPUT OUTPUT
${OUTPUT_LINKER_SCRIPT} ${OUTPUT_LINKER_SCRIPT}
COMMAND COMMAND

View File

@ -1,3 +0,0 @@
rm -rf build
PORTAL64_WITH_DEBUGGER=0 PORTAL64_WITH_RSP_PROFILER=0 PORTAL64_WITH_GFX_VALIDATOR=0 make all_languages
PORTAL64_WITH_DEBUGGER=0 PORTAL64_WITH_RSP_PROFILER=0 PORTAL64_WITH_GFX_VALIDATOR=0 make

View File

@ -1,25 +0,0 @@
##!/bin/bash
# Check if an argument is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <path/to/portal.z64>"
exit 1
fi
# Get the provided binary path from the argument
BINARY_PATH="$1"
# Check if the file exists
if [ -f "$BINARY_PATH" ]; then
# Calculate the size of the binary
size=$(stat -c%s "$BINARY_PATH")
# Pad zeros until the size is a multiple of 512
while [ $((size % 512)) -ne 0 ]; do
printf '\000' >> "$BINARY_PATH"
size=$((size + 1))
done
else
echo "File not found: $BINARY_PATH"
fi

View File

@ -11,7 +11,7 @@ sudo apt update
# Install various packages # Install various packages
sudo apt install -y \ sudo apt install -y \
binutils-mips-n64 \ binutils-mips-n64 \
build-essential build-essential \
cimg-dev \ cimg-dev \
cmake \ cmake \
ffmpeg \ ffmpeg \
@ -45,8 +45,6 @@ sudo apt-get update && sudo apt-get install libxfixes3 libxi6 libxkbcommon0 libx
sudo snap install blender --channel=3.6lts/stable --classic sudo snap install blender --channel=3.6lts/stable --classic
# Append environment variables to .bashrc # Append environment variables to .bashrc
echo 'export N64_LIBGCCDIR=/opt/crashsdk/lib/gcc/mips64-elf/12.2.0' >> ~/.bashrc
echo 'export BLENDER_3_6=/snap/bin/blender' >> ~/.bashrc
echo 'export PATH=$PATH:/opt/crashsdk/bin' >> ~/.bashrc echo 'export PATH=$PATH:/opt/crashsdk/bin' >> ~/.bashrc
echo 'export ROOT=/etc/n64' >> ~/.bashrc echo 'export ROOT=/etc/n64' >> ~/.bashrc
@ -58,9 +56,4 @@ pipx install vpk
# Source the updated .bashrc to apply changes in the current terminal # Source the updated .bashrc to apply changes in the current terminal
source ~/.bashrc source ~/.bashrc
echo "Setup is almost complete. Add the files from the Portal folder to portal64/vpk"
read -p "When complete, press Enter to finish setup."
# Displaying 'Setup complete' message after user input
echo "Setup complete. Please restart the terminal if paths are not updated." echo "Setup complete. Please restart the terminal if paths are not updated."

56
vpk/README.md Normal file
View File

@ -0,0 +1,56 @@
# Source Portal Files
Game assets from Portal are sourced from the original game's files, which must be supplied separately. Copy the entire Portal folder to this directory
(`vpk/`).
If you are not using Docker, you can use a symbolic link.
```sh
ln -s <SteamLibrary>/steamapps/common/Portal vpk/Portal
```
At a minimum, the following directory structure is required. However, it is
easier and less error prone to just copy everything.
```
vpk/
└── Portal/
├── hl2/
│ ├── media/
│ │ └── valve.bik
│ |── resource/
│ ├── hl2_misc_000.vpk
│ ├── hl2_misc_001.vpk
│ ├── hl2_misc_002.vpk
│ ├── hl2_misc_003.vpk
│ ├── hl2_misc_dir.vpk
│ ├── hl2_sound_misc_000.vpk
│ ├── hl2_sound_misc_001.vpk
│ ├── hl2_sound_misc_002.vpk
│ └── hl2_sound_misc_dir.vpk
└── portal/
├── resource/
├── portal_pak_000.vpk
├── portal_pak_001.vpk
├── portal_pak_002.vpk
├── portal_pak_003.vpk
├── portal_pak_004.vpk
├── portal_pak_005.vpk
└── portal_pak_dir.vpk
```
## Add Multiple Audio Languages
The original game supports English, French, German, Russian, and Spanish audio.
This project only uses English audio by default. If you want audio languages
other than English, follow the steps below for each desired additional language.
1. Change the current language for Portal in Steam to the desired language using
the game properties menu. The game will update.
2. Open `<SteamLibrary>/steamapps/common/Portal/portal` and find the
`portal_sound_vo_*.vpk` files corresponding to the new language.
3. Copy the language audio VPKs to `vpk/`. **These files must be copied because
Steam only keeps the files of one language at a time.**
When building, set the `AUDIO_LANGUAGES` variable appropriately. See
[Building the Game](../documentation/building/building.md#optional-settings).

View File

@ -1,124 +0,0 @@
# Source Portal Files
Copy the entire Portal folder, or create a symbolic link, in this folder (`vpk/`).
```sh
ln -s SteamLibrary\steamapps\common\Portal\ Portal
```
At a minimum, the following directory structure is required:
```
vpk/
└── Portal/
├── hl2/
│ ├── media/
│ │ └── valve.bik
│ |── resource/
│ | ├── gameui_english.txt
│ | └── valve_english.txt
| ├── hl2_misc_000.vpk
| ├── hl2_misc_001.vpk
| ├── hl2_misc_002.vpk
| ├── hl2_misc_003.vpk
| ├── hl2_misc_dir.vpk
| ├── hl2_sound_misc_000.vpk
| ├── hl2_sound_misc_001.vpk
| ├── hl2_sound_misc_002.vpk
| └── hl2_sound_misc_dir.vpk
└── portal/
├── resource/
| ├── closecaption_english.txt
| └── portal_english.txt
├── portal_pak_000.vpk
├── portal_pak_001.vpk
├── portal_pak_002.vpk
├── portal_pak_003.vpk
├── portal_pak_004.vpk
├── portal_pak_005.vpk
└── portal_pak_dir.vpk
```
## Add multiple audio languages
Only English is audio included by default. If you want multi-language support,
copy the `portal_sound_vo_*.vpk` files found in `SteamLibrary/steamapps/common/Portal/portal`
to `vpk/`. These files need to be copied, because the original Portal keeps only
the files of ONE language at a time.
Change the current language for Portal in Steam to the desired language. After
Portal updates to the new language, copy the new language files and paste them
in `vpk/`.
Do this for each one of the languages you want to add to the ROM.
* German:
```
portal/portal_sound_vo_german_000.vpk -> vpk/
portal/portal_sound_vo_german_dir.vpk -> vpk/
```
```sh
make german_audio
```
* French:
```
portal/portal_sound_vo_french_000.vpk -> vpk/
portal/portal_sound_vo_french_dir.vpk -> vpk/
```
```
make french_audio
```
* Russian:
```
portal/portal_sound_vo_russian_000.vpk -> vpk/
portal/portal_sound_vo_russian_dir.vpk -> vpk/
```
```
make russian_audio
```
* Spanish:
```
portal/portal_sound_vo_spanish_000.vpk -> vpk/
portal/portal_sound_vo_spanish_dir.vpk -> vpk/
```
```
make spanish_audio
```
* All languages:
```
portal_sound_vo_german_000.vpk -> vpk/
portal_sound_vo_german_dir.vpk -> vpk/
portal_sound_vo_french_000.vpk -> vpk/
portal_sound_vo_french_dir.vpk -> vpk/
portal_sound_vo_russian_000.vpk -> vpk/
portal_sound_vo_russian_dir.vpk -> vpk/
portal_sound_vo_spanish_000.vpk -> vpk/
portal_sound_vo_spanish_dir.vpk -> vpk/
```
```sh
# This will also build the ROM
make all_languages
```
After setting up your desired languages, you can run `make` to build the ROM as
normal.
## Add multiple subtile languages
To include additional subtitle languages, copy the following files from the
original Portal game directory into the corresponding locations under `vpk/Portal/`
(see above).
```
hl2/resource/gameui_<language>.txt
hl2/resource/valve_<language>.txt
portal/resource/closecaption_<language>.txt
portal/resource/portal_<language>.txt
```
If copying or symlinking the entire Portal game directory to `vpk/`, these are
picked up automatically.