Files
Luciano Ciccariello cc2c0cc81c Add all known DRA PS1 builds + VERSION refactor (#3817)
Something I've been wanted to do for a while. Importing all DRA builds,
with the recent TEK discovery in the equation, allowed me to get a more
concrete idea of the builds lineage.

I am putting the PR in draft for two reasons:
1. I want to collect feedback on this already big PR.
2. I am planning to make jp10, jp11, us, hk, and jp12 builds optional,
and just let the CI to always test them. Reason is I realize not
everyone has/wants these additional builds. Moreover, it would further
creep the build time.

The most interesting change is
https://github.com/Xeeynamo/sotn-decomp/blob/dec7c323d50ac22fd7511d6e1c1fdb3027ddf82a/include/version.h
, which drastically changes how versions are tested on the
pre-processor. Gone are `VERSION_US` and friends. Instead they're
replaced with `#define VER_US 19970901U`, corresponding to the greatest
creation date of each file from a given build. TEK and HD have unknown
build dates, so I gave them numbers prior to `VER_JP10`.

This allows us to document the code as follows:

```
// before
#if defined(VERSION_US) || defined(VERSION_EU) || defined(VERSION_HK) ||       \
    defined(VERSION_USPROTO) || defined(VERSION_JP10) ||                       \
    defined(VERSION_JP11) || defined(VERSION_JP12)

// after
#if VERSION >= VERSION_JP10
```

Helpers such as `IS_VER_INTL` are created to indicate all English PS1
builds, excluding the USPROTO. INTL is a short name for "International".

I took the chance to also change how we test a region with the new macro
`REGION_*`. The PSP exclusive paths are now tested with `'#if TARGET ==
TARGET_PSP`. I could've used `#if defined(TARGET_PSP)` but we may have
run to the same traps as earlier. Instead, we could create a simple
helper to do `#if IS_TARGET_PSP` but I did not want to add too many
unnecessary wrappers.

I also eliminate almost all inverted conditions. `#if !(defined(xxx) &&
defined(yyy))` and similar were far too hard to read.

`VER_NEXT` is our custom "ultimate" build with community fixes. It could
be paired with `PLATFORM_PSYZ`, which now replaces `VERSION_PC`
2026-11-07 11:49:01 +00:00

65 lines
2.6 KiB
C

#ifndef INCLUDE_ASM_H
#define INCLUDE_ASM_H
#include "version.h"
#define STRINGIFY_(x) #x
#define STRINGIFY(x) STRINGIFY_(x)
#define ASM_RODATA __asm__(".section .rodata")
#if TARGET != TARGET_PSP && !defined(PERMUTER)
#ifdef SKIP_ASM
#define INCLUDE_ASM(FOLDER, NAME)
#define INCLUDE_RODATA(FOLDER, NAME)
#endif
#ifndef INCLUDE_ASM
#ifndef INCLUDE_ASM_OLD
#define INCLUDE_ASM(FOLDER, NAME) \
__asm__(".pushsection .text\n" \
"\t.align\t2\n" \
"\t.globl\t" #NAME ".NON_MATCHING\n" \
"\t.ent\t" #NAME "\n" #NAME ":\n" \
"\t.type\t" #NAME ".NON_MATCHING, @object\n" \
"\t" #NAME ".NON_MATCHING:\n" \
".include \"asm/" VERSION_STR "/" FOLDER "/" #NAME ".s\"\n" \
"\t.set reorder\n" \
"\t.set at\n" \
"\t.end\t" #NAME "\n" \
".popsection")
#else
#define INCLUDE_ASM(FOLDER, NAME) \
__asm__(".pushsection .text\n" \
"\t.align\t2\n" \
"\t.globl\t" #NAME ".NON_MATCHING\n" \
"\t.ent\t" #NAME "\n" #NAME ":\n" \
"\t.type\t" #NAME ".NON_MATCHING, @object\n" \
"\t" #NAME ".NON_MATCHING:\n" \
".include \"" FOLDER "/" #NAME ".s\"\n" \
"\t.set reorder\n" \
"\t.set at\n" \
"\t.end\t" #NAME "\n" \
".popsection")
#endif
#define INCLUDE_RODATA(FOLDER, NAME) \
__asm__(".pushsection .rodata\n" \
".include \"asm/" VERSION_STR "/" FOLDER "/" #NAME ".s\"\n" \
".popsection")
#endif
// omit .global
#ifdef USE_INCLUDE_ASM
__asm__(".include \"macro.inc\"\n");
#endif
#else // PERMUTER || TARGET_PSP
#define INCLUDE_ASM(FOLDER, NAME)
#define INCLUDE_RODATA(FOLDER, NAME)
#endif
#endif