Commit Graph

1619 Commits

Author SHA1 Message Date
Matt Penny
6b4222e743 Automatic discovery of libgcc, remove newlib dependency (for now)
Implemented strcpy and strlen, which were all that were needed
(math functions and sprintf are in libultra).

To move further away from libultra, some standard library
implementation - such as newlib - will either need to be added
back later, or if the usage is small, functions can be reimplemented.
For now, removing it makes building easier.
2024-11-02 20:44:58 -04:00
Matt Penny
1bb1a71aae Remove build directory name from includes in main linker script 2024-11-02 02:30:11 -04:00
Matt Penny
a29bb36041 Do not rely on hardcoded directories when linking
* Use preprocessor directives to pass microcode object file paths

* Add build directory to include path when preprocessing, so directory
  name is not needed when including generated linker script fragments

* Pass required files on the command line so wildcard matching can be used

* Also remove special case for creating object file for boot code (use
  incbin in asm file instead)
2024-11-02 02:07:08 -04:00
Haydn Trigg
dd1f1d5b07
Fix spelling of collisionObjectShouldGenerateContacts (#92) 2024-10-30 21:19:54 -04:00
Haydn Trigg
d16bf1ac01
Fix floating point syntax (#91)
* plane.c fix floating point syntax

* Update quaternion.c

* Update matrix.c

* Update collision_scene.c
2024-10-30 21:14:48 -04:00
Matt Penny
11a81e100f Refactor linker script segment generation
* Code for this now lives in one place instead of 3. This will make it
  easier to generate with CMake.
* Simplify subtitle alignment
2024-10-25 02:08:09 -04:00
Matt Penny
4c1484d5e6 Use PROJECT_BINARY_DIR instead of CMAKE_BINARY_DIR 2024-10-22 00:13:54 -04:00
Matt Penny
1a10e45682 Clean up skeletool CMake integration, and use consistent naming
Renamed all instances of skelatool -> skeletool. This is more consistent
than the mixed usage previously, which consequently makes adding the
external project in CMake easier.
2024-10-21 23:29:43 -04:00
Matt Penny
b04e404b0b CMake: finish skeletool integration
* Embed Lua scripts in a cross-platform way (generated C source files)
* Automatically find `luac`
* Automatically build skeletool when building main project
2024-10-21 22:50:17 -04:00
Matt Penny
80a896d508 Namespaced name for imported libultra target 2024-10-19 21:33:42 -04:00
Matt Penny
e61142b902 Build skeletool with CMake 2024-10-19 21:18:15 -04:00
Matt Penny
3b9fba522b Get Skeletool dependencies from system
Do not install while building
2024-10-19 21:18:14 -04:00
Matt Penny
42a9189c95 CMake: get assembly working
* Assemble through `gcc` instead of `as` directly, so source files are
  preprocessed (i.e., `#include`)
* `gcc` does not pass `-I` include directories to `as`. This can
  supposedly be fixed by recompiling `gcc` with `--with-gnu-as`. Popular
  N64 toolchain binary distributions don't do this, and to lower the
  barrier to entry I don't want to force users to have to compile their
  own. Work around it by passing `-Wa,-I`.
* CMake only finds assembly dependencies when preprocessing, not when
  assembling. Use `#include` instead of `.include` to work around this.
  The `.incbin`s used by `sound_data.s` are covered by the
  sound_data_tables target dependency.
2024-10-19 16:30:58 -04:00
Matt Penny
4e9e9d32d6 ASM: simplify, document, start integrating with CMake
* Refactor entry point
* Remove unused code
* Reformat level header to be more clear, and add more comments

Looks like assembling with CMake will require some changes to the
assembler flags, and possibly some manual dependency specification.
2024-10-19 02:38:52 -04:00
Matt Penny
1cb12690b8 Fix UV mapping on elevator bottom edge 2024-10-17 21:20:01 -04:00
Matt Penny
22ea93d19f CMake: automatically find programs used in build
Blender 3.6 and ImageMagick 6 versions are also enforced
2024-10-17 21:04:48 -04:00
Matt Penny
08368ffa25 Remove mpg123 dependency
It was used to convert MP3 -> WAV, which ffmpeg can do.
2024-10-17 18:44:24 -04:00
Matt Penny
86aaad1b3b CMake: suppress sox warnings 2024-10-17 18:20:55 -04:00
Matt Penny
259181f2b5 CMake: add find module for libultra, improve N64 toolchain file
* Less hard-coding when searching for libultra
* Proper compiler, assembler, and linker flags
* Multiple build types
* Support for multi-config generators
2024-10-17 18:14:15 -04:00
Matt Penny
9546c509a8 CMake: generate and link localized strings 2024-10-10 01:14:17 -04:00
Matt Penny
08dc063227 Use proper default material for fleck_ash2
Previously, grav_flare was used (likely due to a copy/paste error),
resulting in a warning during build and unnecessary texture data
being included in the fleck_ash2 generated model.
2024-10-09 22:55:53 -04:00
Matt Penny
ddac6daeff CMake: prevent double work when using parallel make 2024-10-09 22:49:02 -04:00
Matt Penny
87f931a8e4 CMake: link level and model animation data 2024-10-09 21:57:39 -04:00
Matt Penny
6c625e39e6 CMake: link generated code 2024-10-08 00:25:30 -04:00
Matt Penny
1d0b22df61 Generate dynamic model lists with CMake, + refactor
* When building with CMake, dynamic model lists are now generated
* Factored common code out of generate_*_list.js files to deduplicate
* Better separated generated model lists from main game code
    `dynamic_asset_data.c` and `dynamic_animated_asset_data.c`
    previously #included the corresponding generated headers, and
    `dynamic_asset_loader.c` declared externs for the contents.

    This messiness was likely done so the generated code would be built
    automatically (the Makefile globs all C files under `src/`).

    Now, model list data is output to C source files which are built
    explicitly. This, with some refactoring, allows the previously
    mentioned source files and externs to be removed.

    This is a bit hacky in the Makefile but will be automatic under
    CMake by using target properties.
* Reorganized some files under `tools/`
2024-10-05 21:11:49 -04:00
Matt Penny
9643719a31 Fix incorrect variable name for Python executable in CMake build 2024-10-05 02:04:39 -04:00
Matt Penny
e1e6a53aa6 Convert models during CMake build
No generation of dynamic model lists yet
2024-10-05 01:54:55 -04:00
Matt Penny
1e8a4f5458 Remove empty linked list files 2024-10-05 01:24:56 -04:00
Matt Penny
2e6f8ac86b Reflect proper default scene scale in defs.h
This value is set when compiling anyway, but this change makes the value
match for consistency.

Now that the default is the actual intended value, it doesn't need to be
overridden in the Makefile, but since scene scale needs to be passed to
skeletool regardless I'm going to keep the preprocessor define too so
they don't get out of sync.
2024-10-05 01:24:56 -04:00
Matt Penny
6607838b8d Rename skeletool loadScene() isLevel argument to shouldSimplify and invert logic
This is more accurate to what the code is actually used for, making it
easier to understand.
2024-10-05 00:07:13 -04:00
Matt Penny
a652558a4c Remove unused material door_frame_01 2024-10-04 23:47:41 -04:00
Matt Penny
7d5caf5912 Remove unnecessary model flags 2024-10-04 22:42:21 -04:00
Matt Penny
6a14db3a16 Start to hook up code generation with CMake builds
Automatically generate material, sound, and level data.

Generated code is not currently linked.
2024-09-26 23:06:10 -04:00
Matt Penny
51e7e001a5 Link to libultra for CMake builds
Libultra include directory and library path are now found dynamically and
saved in a CMake cache variable so they can be overridden by users.

The game now links to libultra. Most linker errors are now due to lack of
integration with generated code dependencies.
2024-09-26 00:36:44 -04:00
Matt Penny
bc2052527c Generate game version for CMake builds and fix generated level names
With CMake, the game version is stored in a generated header file so
dependencies on it are kept track of automatically.

The game now compiles when using CMake but does not link.

Generated code dependencies are not hooked up yet and corresponding
targets need to be built manually.
2024-09-25 22:24:16 -04:00
Matt Penny
9e633b868b Work on CMake compilation
About half of the source files compile.
Need to hook up generated code, compiler definitions, and dependencies.
2024-09-24 01:27:18 -04:00
Matt Penny
a67288f62e Add barebones N64 CMake toolchain files
Just focus on compilation for now
2024-09-24 01:02:03 -04:00
Matt Penny
fa0940fe90 Work on CMake conversion: test chambers
Incidental changes along the way:
* Move `export_level.lua` to `tools/level_scripts/`
* Small reorganizations/fixes to existing `CMakeLists.txt` files
* Support passing absolute paths to level export
2024-09-13 00:53:55 -04:00
Matt Penny
dea0c3591d Work on CMake conversion: sound transformation, conversion, and table generation
Some parts need to be cleaned up/removed/streamlined after the CMake
build can build the game on its own and compatibility with what the
old makefile does is no longer needed.
2024-09-12 02:17:28 -04:00
Matt Penny
8845a96667 Don't special case valve.aifc generation
It is still necessary to special case extracting the raw WAV from the
video, but now conversion is handled using a .sox file just like the
other sounds.

This simplifies sound processing for the CMake transition.
2024-09-12 02:17:26 -04:00
Matt Penny
ad66fb116c Store generated Valve image in portal_pak_modified/, not build/
To better organize generated files, portal_pak_modified/ will be used
for files generated by modifying portal_pak_dir/ contents.

Build/ will be for conversion to a final form needed for compilation,
without content modification.
2024-09-11 20:13:57 -04:00
Matt Penny
0d2cd6efe0 Work on CMake conversion: sound transformation 2024-09-09 23:34:16 -04:00
Matt Penny
e2d4631ad1 Use .sox, not .jsox for elevator_move_loop1
Effects aren't used for this sound, so .jsox is unnecessary
2024-09-09 22:07:49 -04:00
Matt Penny
2fcea7f9d2 Work on CMake conversion: material generation 2024-09-07 20:00:45 -04:00
Matt Penny
ad38717b04 Update clock digit image name in Blend file so it previews properly 2024-09-06 01:37:47 -04:00
Matt Penny
b999e139fa Work on CMake conversion: VPK extract and texture conversion 2024-09-06 01:26:08 -04:00
Matt Penny
2f1171fccf Stitch together clock digits in .ims file, not makefile
Simplifies asset conversion for CMake transition
2024-09-06 01:26:08 -04:00
Matt Penny
12f1332d9d Copy awe_total via .ims file, not makefile
Simplifies asset conversion for CMake transition
2024-09-06 01:26:08 -04:00
Matt Penny
dfe9a39d7a Use latest Ubuntu LTS (24.04) for docker build and fix git permission issues 2024-08-28 19:48:50 -04:00
Matt Penny
bf6a5a643f Support building from source code archive (#85)
Save git describe output on `git archive` and fall back to saved
output for version number if building outside of a git repo.
2024-08-26 16:36:12 -04:00