Commit Graph

8 Commits

Author SHA1 Message Date
nocato 1ce16d8f69 Uninitializer - injecting uninitialized memory to built overlays 2023-11-07 17:56:41 +01:00
nocato 03782adeda Link PsyQ overlay functions with actual PsyQ (extracted objs for now...) 2023-10-14 22:51:42 +02:00
nocato 9d90ef6112 Don't hardcode OLAY_BASE 2023-10-14 15:40:51 +02:00
nocato b818b01b0e Run linker separately for each overlay
Some overlays share the same source files. An extreme example of it
are "select2", "select3"... overlays that consist of the same 
"Game/select.c" file.

However, if you try to link 2 overlays that have the same symbols
(global variable names) you get "symbol multiply defined" error.
Moreover, when building an overlay source file the resulting object
file has all sections prefixed by the overlay name (we would have to
build those files multiple times with different prefixes).

Solve the issue by running the linker multiple times. Each execution
builds a separate overlay (and unfortunately also a separate main exe).

Show that it works by building "select2", "select3", ... overlays.

Another benefit of it is that we now generate a separate .sym file
per each overlay (not a single one where all the symbols are mixed).
2023-09-29 19:32:16 +02:00
Kieron 34fe2fe284 Fix linker warnings & add overlay base macro 2023-09-25 17:20:53 +01:00
nocato dbe400128e Pass MAIN_EXE/VR_EXE to compilation/templating
To make it possible to actually build a different executable for VR,
"MAIN_EXE" or "VR_EXE" define is passed to the preprocessor, so that
 #ifdefs can be introduced into the code:

  #ifdef VR_EXE
  ... VR exe specific code ...
  #endif

Similarly, those defines are also passed to the linker_command_file.txt
templating, where it can be used this way:

{% if MAIN_EXE %}
    include "{{OBJ_DIR}}\Equip\jpegcam.obj"
{% endif %}
2023-09-22 22:55:08 +02:00
nocato 9dc7a6d861 Allow building to a different directory than "obj/"
This commit modifies the build system for it to be able to build the 
project to a different directory than "obj/". This will be used to
build the VR exe to "obj_vr/" in the coming commits.
2023-09-22 22:49:08 +02:00
nocato 390d48fcc6 Add linker_command_file.txt preprocessing step
Before this change, linker_command_file.txt was a static file used by
psylink. However, VR executable will require a slightly different
linker_command_file.txt (only a few slight differences).

To avoid duplication (having multiple linker_command_file.txt files),
this commit now treats this file as a template. Jinja2 library is used
as a template engine (it's a bit of an overkill, but cpp preprocessor
tried to be too clever and failed parsing linker_command_file.txt).

This change will allow us to have a single linker_command_file.txt,
which will dynamically build to different variants.
2023-09-22 22:47:34 +02:00