mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-30 15:00:13 -05:00
add support for clang compiler (#592)
* hacks to align strings for clang... wow just wow
* start work to getting built with clang
* fix issues with struct constructors, all builds, doesn't link still
* fix some narrowing issues that clang complains about
* fix compliation of zapd
* fix null deref in VersionInfo
* builds with clang
* make stringbuilding use StringHelper instead of addition
* fix linking
* add CLANG SHIP overlay on clang built versions
* doesn't need to be volatile
* mark unknown strings as extern
* rename some stuff
* can't align extern
* hopefully fix compilation for everythign
* expandtab
* allow setting LD
* Revert "allow setting LD"
This reverts commit 711aba6db2
.
maybe to use lld it should be a LDFLAG?
* -Wno-deprecated-declarations is required for newer versions of clang
on macOS 13 beta sdk, the version of apple clang requires this
* Add jenkins support for clang
* Forward CXX flags to stormlib compilation
* Move GCC only flags to check
* use exports to set multiarch setup
* Fix Jenkins forever
* use make instead of cmake --build
add some flags to build with clang-11 as well
* address review coments
- rework extraction to allow multi thread
- misc readability cleanup
* update makefile to add WARN on linux+clang
Co-authored-by: David Chavez <david@dcvz.io>
This commit is contained in:
parent
89e07f8dbb
commit
d4c1c40c1d
@ -48,7 +48,7 @@ make -j $(nproc) OPTFLAGS=-O2 DEBUG=0
|
|||||||
|
|
||||||
## macOS
|
## macOS
|
||||||
|
|
||||||
1. Requires `gcc@12, sdl2, libpng, glew, dylibbundler` (can be installed via brew, etc)
|
1. Requires Xcode (or xcode-tools) && `sdl2, libpng, glew, dylibbundler` (can be installed via brew, etc)
|
||||||
```bash
|
```bash
|
||||||
# Clone the repo
|
# Clone the repo
|
||||||
git clone https://github.com/HarbourMasters/Shipwright.git
|
git clone https://github.com/HarbourMasters/Shipwright.git
|
||||||
@ -59,9 +59,9 @@ cp <path to your ROM> OTRExporter
|
|||||||
cd soh
|
cd soh
|
||||||
# Extract the assets/Compile the exporter/Run the exporter
|
# Extract the assets/Compile the exporter/Run the exporter
|
||||||
# -jX defines number of cores to use for compilation - lower or remove entirely if having issues
|
# -jX defines number of cores to use for compilation - lower or remove entirely if having issues
|
||||||
make setup -j8 DEBUG=0 CC=gcc-12 CXX=g++-12
|
make setup -j8 DEBUG=0
|
||||||
# Compile the code (watch the -j parameter as above)
|
# Compile the code (watch the -j parameter as above)
|
||||||
make -j8 DEBUG=0 CC=gcc-12 CXX=g++-12
|
make -j8 DEBUG=0
|
||||||
# Create macOS app bundle
|
# Create macOS app bundle
|
||||||
make filledappbundle
|
make filledappbundle
|
||||||
```
|
```
|
||||||
|
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@ -137,8 +137,8 @@ pipeline {
|
|||||||
sh '''
|
sh '''
|
||||||
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
|
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
|
||||||
cd soh
|
cd soh
|
||||||
make setup -j4 DEBUG=0 OPTFLAGS=-O2 CC=gcc-12 CXX=g++-12
|
export CC="clang -arch arm64 -arch x86_64"; export CXX="clang++ -arch arm64 -arch x86_64"; make setup -j4 OPTFLAGS=-O2 DEBUG=0 LD="ld"
|
||||||
make -j4 DEBUG=0 OPTFLAGS=-O2 CC=gcc-12 CXX=g++-12
|
export CC="clang -arch arm64 -arch x86_64"; export CXX="clang++ -arch arm64 -arch x86_64"; make -j4 DEBUG=0 OPTFLAGS=-O2 LD="ld"
|
||||||
make -j4 appbundle
|
make -j4 appbundle
|
||||||
mv ../README.md readme.txt
|
mv ../README.md readme.txt
|
||||||
7z a soh-mac.7z soh.app readme.txt
|
7z a soh-mac.7z soh.app readme.txt
|
||||||
|
@ -96,14 +96,14 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
{
|
{
|
||||||
case G_NOOP:
|
case G_NOOP:
|
||||||
{
|
{
|
||||||
Gfx value = gsDPNoOp();
|
Gfx value = {gsDPNoOp()};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_ENDDL:
|
case G_ENDDL:
|
||||||
{
|
{
|
||||||
Gfx value = gsSPEndDisplayList();
|
Gfx value = {gsSPEndDisplayList()};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t nnnn = (data & 0x0000FFFF00000000ULL) >> 32;
|
int32_t nnnn = (data & 0x0000FFFF00000000ULL) >> 32;
|
||||||
int32_t vvvvvvvv = (data & 0x00000000FFFFFFFFULL);
|
int32_t vvvvvvvv = (data & 0x00000000FFFFFFFFULL);
|
||||||
|
|
||||||
Gfx value = gsSPModifyVertex(nnnn / 2, ww, vvvvvvvv);
|
Gfx value = {gsSPModifyVertex(nnnn / 2, ww, vvvvvvvv)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -131,35 +131,35 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t cccccc = (data & 0x00FFFFFF00000000) >> 32;
|
int32_t cccccc = (data & 0x00FFFFFF00000000) >> 32;
|
||||||
int32_t ssssssss = (data & 0xFFFFFFFF);
|
int32_t ssssssss = (data & 0xFFFFFFFF);
|
||||||
|
|
||||||
Gfx value = gsSPGeometryMode(~cccccc, ssssssss);
|
Gfx value = {gsSPGeometryMode(~cccccc, ssssssss)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_RDPPIPESYNC:
|
case G_RDPPIPESYNC:
|
||||||
{
|
{
|
||||||
Gfx value = gsDPPipeSync();
|
Gfx value = {gsDPPipeSync()};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_RDPLOADSYNC:
|
case G_RDPLOADSYNC:
|
||||||
{
|
{
|
||||||
Gfx value = gsDPLoadSync();
|
Gfx value = {gsDPLoadSync()};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_RDPTILESYNC:
|
case G_RDPTILESYNC:
|
||||||
{
|
{
|
||||||
Gfx value = gsDPTileSync();
|
Gfx value = {gsDPTileSync()};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_RDPFULLSYNC:
|
case G_RDPFULLSYNC:
|
||||||
{
|
{
|
||||||
Gfx value = gsDPFullSync();
|
Gfx value = {gsDPFullSync()};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -169,14 +169,14 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t hhhhhh = (data & 0x00FFFFFF00000000) >> 32;
|
int32_t hhhhhh = (data & 0x00FFFFFF00000000) >> 32;
|
||||||
int32_t llllllll = (data & 0x00000000FFFFFFFF);
|
int32_t llllllll = (data & 0x00000000FFFFFFFF);
|
||||||
|
|
||||||
Gfx value = gsDPSetOtherMode(hhhhhh, llllllll);
|
Gfx value = {gsDPSetOtherMode(hhhhhh, llllllll)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case G_POPMTX:
|
case G_POPMTX:
|
||||||
{
|
{
|
||||||
Gfx value = gsSPPopMatrix(data);
|
Gfx value = {gsSPPopMatrix(data)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
uint8_t b = (uint8_t)((data & 0xFF00FF00) >> 8);
|
uint8_t b = (uint8_t)((data & 0xFF00FF00) >> 8);
|
||||||
uint8_t a = (uint8_t)((data & 0x000000FF) >> 0);
|
uint8_t a = (uint8_t)((data & 0x000000FF) >> 0);
|
||||||
|
|
||||||
Gfx value = gsDPSetEnvColor(r, g, b, a);
|
Gfx value = {gsDPSetEnvColor(r, g, b, a)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
|
|
||||||
mm = (mm & 0x0FFFFFFF) + 1;
|
mm = (mm & 0x0FFFFFFF) + 1;
|
||||||
|
|
||||||
Gfx value = gsSPMatrix(mm, pp);
|
Gfx value = {gsSPMatrix(mm, pp)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
uint32_t mm = (data & 0x00000000FFFFFFFF);
|
uint32_t mm = (data & 0x00000000FFFFFFFF);
|
||||||
pp ^= G_MTX_PUSH;
|
pp ^= G_MTX_PUSH;
|
||||||
|
|
||||||
Gfx value = gsSPMatrix(mm, pp);
|
Gfx value = {gsSPMatrix(mm, pp)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t xxx = (data & 0x0000000000FFF000) >> 12;
|
int32_t xxx = (data & 0x0000000000FFF000) >> 12;
|
||||||
int32_t ddd = (data & 0x0000000000000FFF);
|
int32_t ddd = (data & 0x0000000000000FFF);
|
||||||
|
|
||||||
Gfx value = gsDPLoadBlock(i, sss, ttt, xxx, ddd);
|
Gfx value = {gsDPLoadBlock(i, sss, ttt, xxx, ddd)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t vvvv = (data & 0xFFFF00000000) >> 32;
|
int32_t vvvv = (data & 0xFFFF00000000) >> 32;
|
||||||
int32_t wwww = (data & 0x0000FFFF);
|
int32_t wwww = (data & 0x0000FFFF);
|
||||||
|
|
||||||
Gfx value = gsSPCullDisplayList(vvvv / 2, wwww / 2);
|
Gfx value = {gsSPCullDisplayList(vvvv / 2, wwww / 2)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
uint32_t z = (data & 0x00000000FFFFFFFF) >> 0;
|
uint32_t z = (data & 0x00000000FFFFFFFF) >> 0;
|
||||||
uint32_t h = (data & 0xFFFFFFFF);
|
uint32_t h = (data & 0xFFFFFFFF);
|
||||||
|
|
||||||
Gfx value = gsSPBranchLessZraw3(h & 0x00FFFFFF);
|
Gfx value = {gsSPBranchLessZraw3(h & 0x00FFFFFF)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
break;
|
break;
|
||||||
case G_RDPHALF_2:
|
case G_RDPHALF_2:
|
||||||
{
|
{
|
||||||
Gfx value = gsDPWordLo(data & 0xFFFFFFFF);
|
Gfx value = {gsDPWordLo(data & 0xFFFFFFFF)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -305,7 +305,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t XXX = (data & 0x0000000000FFF000) >> 12;
|
int32_t XXX = (data & 0x0000000000FFF000) >> 12;
|
||||||
int32_t YYY = (data & 0x0000000000000FFF);
|
int32_t YYY = (data & 0x0000000000000FFF);
|
||||||
|
|
||||||
Gfx value = gsSPTextureRectangle2(XXX, YYY, xxx, yyy, i);
|
Gfx value = {gsSPTextureRectangle2(XXX, YYY, xxx, yyy, i)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
|
|
||||||
int bp = 0;
|
int bp = 0;
|
||||||
|
|
||||||
Gfx value = gsSPBranchLessZraw2(0xDEADABCD, (a / 5) | (b / 2), z);
|
Gfx value = {gsSPBranchLessZraw2(0xDEADABCD, (a / 5) | (b / 2), z)};
|
||||||
word0 = (value.words.w0 & 0x00FFFFFF) + (G_BRANCH_Z_OTR << 24);
|
word0 = (value.words.w0 & 0x00FFFFFF) + (G_BRANCH_Z_OTR << 24);
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
|
|
||||||
@ -389,9 +389,9 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
u32 dListVal = (data & 0x0FFFFFFF) + 1;
|
u32 dListVal = (data & 0x0FFFFFFF) + 1;
|
||||||
|
|
||||||
if (pp != 0)
|
if (pp != 0)
|
||||||
value = gsSPBranchList(dListVal);
|
value = {gsSPBranchList(dListVal)};
|
||||||
else
|
else
|
||||||
value = gsSPDisplayList(dListVal);
|
value = {gsSPDisplayList(dListVal)};
|
||||||
|
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
@ -469,7 +469,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t ddd = (____ & 0x700) >> 8;
|
int32_t ddd = (____ & 0x700) >> 8;
|
||||||
int32_t nnnnnnn = (____ & 0xFE) >> 1;
|
int32_t nnnnnnn = (____ & 0xFE) >> 1;
|
||||||
|
|
||||||
Gfx value = gsSPTexture(ssss, tttt, lll, ddd, nnnnnnn);
|
Gfx value = {gsSPTexture(ssss, tttt, lll, ddd, nnnnnnn)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -480,7 +480,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t bb = ((data & 0x0000FF0000000000ULL) >> 40) / 2;
|
int32_t bb = ((data & 0x0000FF0000000000ULL) >> 40) / 2;
|
||||||
int32_t cc = ((data & 0x000000FF00000000ULL) >> 32) / 2;
|
int32_t cc = ((data & 0x000000FF00000000ULL) >> 32) / 2;
|
||||||
|
|
||||||
Gfx test = gsSP1Triangle(aa, bb, cc, 0);
|
Gfx test = {gsSP1Triangle(aa, bb, cc, 0)};
|
||||||
word0 = test.words.w0;
|
word0 = test.words.w0;
|
||||||
word1 = test.words.w1;
|
word1 = test.words.w1;
|
||||||
}
|
}
|
||||||
@ -494,7 +494,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t ee = ((data & 0x0000000000FF00ULL) >> 8) / 2;
|
int32_t ee = ((data & 0x0000000000FF00ULL) >> 8) / 2;
|
||||||
int32_t ff = ((data & 0x000000000000FFULL) >> 0) / 2;
|
int32_t ff = ((data & 0x000000000000FFULL) >> 0) / 2;
|
||||||
|
|
||||||
Gfx test = gsSP2Triangles(aa, bb, cc, 0, dd, ee, ff, 0);
|
Gfx test = {gsSP2Triangles(aa, bb, cc, 0, dd, ee, ff, 0)};
|
||||||
word0 = test.words.w0;
|
word0 = test.words.w0;
|
||||||
word1 = test.words.w1;
|
word1 = test.words.w1;
|
||||||
}
|
}
|
||||||
@ -506,7 +506,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t cc = ((data & 0x000000FF00000000ULL) >> 32) / 2;
|
int32_t cc = ((data & 0x000000FF00000000ULL) >> 32) / 2;
|
||||||
int32_t dd = ((data & 0x000000000000FFULL)) / 2;
|
int32_t dd = ((data & 0x000000000000FFULL)) / 2;
|
||||||
|
|
||||||
Gfx test = gsSP1Quadrangle(aa, bb, cc, dd, 0);
|
Gfx test = {gsSP1Quadrangle(aa, bb, cc, dd, 0)};
|
||||||
word0 = test.words.w0;
|
word0 = test.words.w0;
|
||||||
word1 = test.words.w1;
|
word1 = test.words.w1;
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t bb = (data & 0x000000000000FF00) >> 8;
|
int32_t bb = (data & 0x000000000000FF00) >> 8;
|
||||||
int32_t aa = (data & 0x00000000000000FF) >> 0;
|
int32_t aa = (data & 0x00000000000000FF) >> 0;
|
||||||
|
|
||||||
Gfx value = gsDPSetPrimColor(mm, ff, rr, gg, bb, aa);
|
Gfx value = {gsDPSetPrimColor(mm, ff, rr, gg, bb, aa)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -534,7 +534,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
|
|
||||||
// TODO: Output the correct render modes in data
|
// TODO: Output the correct render modes in data
|
||||||
|
|
||||||
Gfx value = gsSPSetOtherMode(0xE2, sft, len, dd);
|
Gfx value = {gsSPSetOtherMode(0xE2, sft, len, dd)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -552,11 +552,11 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
if (sft == 14) // G_MDSFT_TEXTLUT
|
if (sft == 14) // G_MDSFT_TEXTLUT
|
||||||
{
|
{
|
||||||
const char* types[] = { "G_TT_NONE", "G_TT_NONE", "G_TT_RGBA16", "G_TT_IA16" };
|
const char* types[] = { "G_TT_NONE", "G_TT_NONE", "G_TT_RGBA16", "G_TT_IA16" };
|
||||||
value = gsDPSetTextureLUT(dd >> 14);
|
value = {gsDPSetTextureLUT(dd >> 14)};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value = gsSPSetOtherMode(0xE3, sft, nn + 1, dd);
|
value = {gsSPSetOtherMode(0xE3, sft, nn + 1, dd)};
|
||||||
}
|
}
|
||||||
|
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
@ -583,7 +583,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t bbbb = (data & 0b0000000000000000000000000000000000000000000000000000000011110000) >> 4;
|
int32_t bbbb = (data & 0b0000000000000000000000000000000000000000000000000000000011110000) >> 4;
|
||||||
int32_t uuuu = (data & 0b0000000000000000000000000000000000000000000000000000000000001111);
|
int32_t uuuu = (data & 0b0000000000000000000000000000000000000000000000000000000000001111);
|
||||||
|
|
||||||
Gfx value = gsDPSetTile(fff, ii, nnnnnnnnn, mmmmmmmmm, ttt, pppp, cc, aaaa, ssss, dd, bbbb, uuuu);
|
Gfx value = {gsDPSetTile(fff, ii, nnnnnnnnn, mmmmmmmmm, ttt, pppp, cc, aaaa, ssss, dd, bbbb, uuuu)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -607,7 +607,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t ab1 = (data & 0b00000000000000000000000000000000000000000000000000000000111000) >> 3;
|
int32_t ab1 = (data & 0b00000000000000000000000000000000000000000000000000000000111000) >> 3;
|
||||||
int32_t ad1 = (data & 0b00000000000000000000000000000000000000000000000000000000000111) >> 0;
|
int32_t ad1 = (data & 0b00000000000000000000000000000000000000000000000000000000000111) >> 0;
|
||||||
|
|
||||||
Gfx value = gsDPSetCombineLERP2(a0, b0, c0, d0, aa0, ab0, ac0, ad0, a1, b1, c1, d1, aa1, ab1, ac1, ad1);
|
Gfx value = {gsDPSetCombineLERP2(a0, b0, c0, d0, aa0, ab0, ac0, ad0, a1, b1, c1, d1, aa1, ab1, ac1, ad1)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -620,7 +620,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t vvv = (data & 0x0000000000000FFF);
|
int32_t vvv = (data & 0x0000000000000FFF);
|
||||||
int32_t i = (data & 0x000000000F000000) >> 24;
|
int32_t i = (data & 0x000000000F000000) >> 24;
|
||||||
|
|
||||||
Gfx value = gsDPSetTileSize(i, sss, ttt, uuu, vvv);
|
Gfx value = {gsDPSetTileSize(i, sss, ttt, uuu, vvv)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -630,7 +630,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t t = (data & 0x0000000007000000) >> 24;
|
int32_t t = (data & 0x0000000007000000) >> 24;
|
||||||
int32_t ccc = (data & 0x00000000003FF000) >> 14;
|
int32_t ccc = (data & 0x00000000003FF000) >> 14;
|
||||||
|
|
||||||
Gfx value = gsDPLoadTLUTCmd(t, ccc);
|
Gfx value = {gsDPLoadTLUTCmd(t, ccc)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -643,7 +643,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int uuu = (data & 0x0000000000FFF000) >> 12;
|
int uuu = (data & 0x0000000000FFF000) >> 12;
|
||||||
int vvv= (data & 0x0000000000000FFF);
|
int vvv= (data & 0x0000000000000FFF);
|
||||||
|
|
||||||
Gfx value = gsDPLoadTile(i, sss, ttt, uuu, vvv);
|
Gfx value = {gsDPLoadTile(i, sss, ttt, uuu, vvv)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
}
|
}
|
||||||
@ -661,7 +661,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
uint32_t fmt = (__ & 0xE0) >> 5;
|
uint32_t fmt = (__ & 0xE0) >> 5;
|
||||||
uint32_t siz = (__ & 0x18) >> 3;
|
uint32_t siz = (__ & 0x18) >> 3;
|
||||||
|
|
||||||
Gfx value = gsDPSetTextureImage(fmt, siz, www + 1, (seg & 0x0FFFFFFF) + 1);
|
Gfx value = {gsDPSetTextureImage(fmt, siz, www + 1, (seg & 0x0FFFFFFF) + 1)};
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1;
|
word1 = value.words.w1;
|
||||||
|
|
||||||
@ -679,7 +679,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
uint32_t fmt = (__ & 0xE0) >> 5;
|
uint32_t fmt = (__ & 0xE0) >> 5;
|
||||||
uint32_t siz = (__ & 0x18) >> 3;
|
uint32_t siz = (__ & 0x18) >> 3;
|
||||||
|
|
||||||
Gfx value = gsDPSetTextureImage(fmt, siz, www + 1, __);
|
Gfx value = {gsDPSetTextureImage(fmt, siz, www + 1, __)};
|
||||||
word0 = value.words.w0 & 0x00FFFFFF;
|
word0 = value.words.w0 & 0x00FFFFFF;
|
||||||
word0 += (G_SETTIMG_OTR << 24);
|
word0 += (G_SETTIMG_OTR << 24);
|
||||||
//word1 = value.words.w1;
|
//word1 = value.words.w1;
|
||||||
@ -722,7 +722,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
int32_t aa = (data & 0x000000FF00000000ULL) >> 32;
|
int32_t aa = (data & 0x000000FF00000000ULL) >> 32;
|
||||||
int32_t nn = (data & 0x000FF00000000000ULL) >> 44;
|
int32_t nn = (data & 0x000FF00000000000ULL) >> 44;
|
||||||
|
|
||||||
Gfx value = gsSPVertex(data & 0xFFFFFFFF, nn, ((aa >> 1) - nn));
|
Gfx value = {gsSPVertex(data & 0xFFFFFFFF, nn, ((aa >> 1) - nn))};
|
||||||
|
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word1 = value.words.w1 | 1;
|
word1 = value.words.w1 | 1;
|
||||||
@ -745,7 +745,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
|
|||||||
{
|
{
|
||||||
uint32_t diff = segOffset - vtxDecl->address;
|
uint32_t diff = segOffset - vtxDecl->address;
|
||||||
|
|
||||||
Gfx value = gsSPVertex(diff, nn, ((aa >> 1) - nn));
|
Gfx value = {gsSPVertex(diff, nn, ((aa >> 1) - nn))};
|
||||||
|
|
||||||
word0 = value.words.w0;
|
word0 = value.words.w0;
|
||||||
word0 &= 0x00FFFFFF;
|
word0 &= 0x00FFFFFF;
|
||||||
@ -893,4 +893,4 @@ std::string OTRExporter_DisplayList::GetPrefix(ZResource* res)
|
|||||||
prefix = "code";
|
prefix = "code";
|
||||||
|
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ std::map<Ship::ResourceType, uint32_t> resourceVersions;
|
|||||||
|
|
||||||
void InitVersionInfo()
|
void InitVersionInfo()
|
||||||
{
|
{
|
||||||
resourceVersions = {
|
resourceVersions = std::map<Ship::ResourceType, uint32_t> {
|
||||||
{ Ship::ResourceType::Animation, 0 },
|
{ Ship::ResourceType::Animation, 0 },
|
||||||
{ Ship::ResourceType::Model, 0 },
|
{ Ship::ResourceType::Model, 0 },
|
||||||
{ Ship::ResourceType::Texture, 0 },
|
{ Ship::ResourceType::Texture, 0 },
|
||||||
@ -24,4 +24,4 @@ void InitVersionInfo()
|
|||||||
{ Ship::ResourceType::Text, 0 },
|
{ Ship::ResourceType::Text, 0 },
|
||||||
{ Ship::ResourceType::Blob, 0 },
|
{ Ship::ResourceType::Blob, 0 },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ lib/libgfxd/libgfxd.a:
|
|||||||
.PHONY: StormLib
|
.PHONY: StormLib
|
||||||
StormLib:
|
StormLib:
|
||||||
LDFLAGS="" cmake -B ../StormLib/build -S ../StormLib
|
LDFLAGS="" cmake -B ../StormLib/build -S ../StormLib
|
||||||
LDFLAGS="" cmake --build ../StormLib/build
|
$(MAKE) -C ../StormLib/build
|
||||||
|
|
||||||
.PHONY: ExporterTest
|
.PHONY: ExporterTest
|
||||||
ExporterTest:
|
ExporterTest:
|
||||||
|
@ -461,8 +461,8 @@ char* OldMain(char* infilename)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
char comprType[5] = {
|
char comprType[5] = {
|
||||||
CommChunk.compressionTypeH >> 8, CommChunk.compressionTypeH & 0xFF,
|
static_cast<char>(CommChunk.compressionTypeH >> 8), static_cast<char>(CommChunk.compressionTypeH & 0xFF),
|
||||||
CommChunk.compressionTypeL >> 8, CommChunk.compressionTypeL & 0xFF, 0};
|
static_cast<char>(CommChunk.compressionTypeL >> 8), static_cast<char>(CommChunk.compressionTypeL & 0xFF), 0};
|
||||||
fail_parse("file is of the wrong compression type [got %s (%08x)]", &comprType,
|
fail_parse("file is of the wrong compression type [got %s (%08x)]", &comprType,
|
||||||
cType);
|
cType);
|
||||||
}
|
}
|
||||||
@ -603,8 +603,8 @@ char* OldMain(char* infilename)
|
|||||||
{
|
{
|
||||||
s32 startPos = aloops[0].start, endPos = aloops[0].end;
|
s32 startPos = aloops[0].start, endPos = aloops[0].end;
|
||||||
const char* markerNames[2] = {"start", "end"};
|
const char* markerNames[2] = {"start", "end"};
|
||||||
Marker markers[2] = {{1, startPos >> 16, startPos & 0xffff},
|
Marker markers[2] = {{1, static_cast<u16>(startPos >> 16), static_cast<u16>(startPos & 0xffff)},
|
||||||
{2, endPos >> 16, endPos & 0xffff}};
|
{2, static_cast<u16>(endPos >> 16), static_cast<u16>(endPos & 0xffff)}};
|
||||||
write_header(ofile, "MARK", 2 + 2 * sizeof(Marker) + 1 + 5 + 1 + 3);
|
write_header(ofile, "MARK", 2 + 2 * sizeof(Marker) + 1 + 5 + 1 + 3);
|
||||||
s16 numMarkers = bswap16(2);
|
s16 numMarkers = bswap16(2);
|
||||||
fwrite(&numMarkers, sizeof(s16), 1, ofile);
|
fwrite(&numMarkers, sizeof(s16), 1, ofile);
|
||||||
@ -666,4 +666,4 @@ char* OldMain(char* infilename)
|
|||||||
fclose(ifile);
|
fclose(ifile);
|
||||||
fclose(ofile);
|
fclose(ofile);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -800,9 +800,11 @@ void ZFile::GenerateSourceHeaderFiles()
|
|||||||
{
|
{
|
||||||
OutputFormatter formatter;
|
OutputFormatter formatter;
|
||||||
|
|
||||||
|
formatter.Write("#pragma once\n");
|
||||||
|
std::set<std::string> nameSet;
|
||||||
for (ZResource* res : resources)
|
for (ZResource* res : resources)
|
||||||
{
|
{
|
||||||
std::string resSrc = res->GetSourceOutputHeader("");
|
std::string resSrc = res->GetSourceOutputHeader("", &nameSet);
|
||||||
formatter.Write(resSrc);
|
formatter.Write(resSrc);
|
||||||
|
|
||||||
if (resSrc != "")
|
if (resSrc != "")
|
||||||
@ -811,7 +813,7 @@ void ZFile::GenerateSourceHeaderFiles()
|
|||||||
|
|
||||||
for (auto& sym : symbolResources)
|
for (auto& sym : symbolResources)
|
||||||
{
|
{
|
||||||
formatter.Write(sym.second->GetSourceOutputHeader(""));
|
formatter.Write(sym.second->GetSourceOutputHeader("", &nameSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
formatter.Write(ProcessExterns());
|
formatter.Write(ProcessExterns());
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "WarningHandler.h"
|
#include "WarningHandler.h"
|
||||||
#include "ZFile.h"
|
#include "ZFile.h"
|
||||||
#include <Globals.h>
|
#include <Globals.h>
|
||||||
|
#include <set>
|
||||||
#include <ZDisplayList.h>
|
#include <ZDisplayList.h>
|
||||||
#include <ZArray.h>
|
#include <ZArray.h>
|
||||||
|
|
||||||
@ -304,7 +305,7 @@ void ZResource::GetSourceOutputCode([[maybe_unused]] const std::string& prefix)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix)
|
std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix, std::set<std::string> *nameSet)
|
||||||
{
|
{
|
||||||
if (Globals::Instance->otrMode && genOTRDef)
|
if (Globals::Instance->otrMode && genOTRDef)
|
||||||
{
|
{
|
||||||
@ -342,9 +343,20 @@ std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string&
|
|||||||
prefix = "text";
|
prefix = "text";
|
||||||
|
|
||||||
if (prefix != "")
|
if (prefix != "")
|
||||||
str += StringHelper::Sprintf("#define %s \"__OTR__%s/%s/%s\"", name.c_str(), prefix.c_str(), outName.c_str(), nameStr.c_str());
|
str += StringHelper::Sprintf("#define d%s \"__OTR__%s/%s/%s\"", name.c_str(), prefix.c_str(), outName.c_str(), nameStr.c_str());
|
||||||
else
|
else
|
||||||
str += StringHelper::Sprintf("#define %s \"__OTR__%s/%s\"", name.c_str(), outName.c_str(), nameStr.c_str());
|
str += StringHelper::Sprintf("#define d%s \"__OTR__%s/%s\"", name.c_str(), outName.c_str(), nameStr.c_str());
|
||||||
|
|
||||||
|
if (nameSet && nameSet->find(name) == nameSet->end()) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
str += StringHelper::Sprintf("\nstatic const __declspec(align(2)) char %s[] = d%s;", name.c_str(), name.c_str());
|
||||||
|
#else
|
||||||
|
str += StringHelper::Sprintf("\nstatic const char %s[] __attribute__((aligned (2))) = d%s;", name.c_str(), name.c_str());
|
||||||
|
#endif
|
||||||
|
if (nameSet) {
|
||||||
|
nameSet->insert(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <set>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -116,7 +117,7 @@ public:
|
|||||||
[[nodiscard]] virtual std::string GetDefaultName(const std::string& prefix) const;
|
[[nodiscard]] virtual std::string GetDefaultName(const std::string& prefix) const;
|
||||||
|
|
||||||
virtual void GetSourceOutputCode(const std::string& prefix);
|
virtual void GetSourceOutputCode(const std::string& prefix);
|
||||||
virtual std::string GetSourceOutputHeader(const std::string& prefix);
|
virtual std::string GetSourceOutputHeader(const std::string& prefix, std::set<std::string> *nameSet);
|
||||||
virtual void CalcHash();
|
virtual void CalcHash();
|
||||||
/**
|
/**
|
||||||
* Exports the resource to binary format
|
* Exports the resource to binary format
|
||||||
|
@ -48,7 +48,7 @@ std::string ZString::GetBodySourceCode() const
|
|||||||
return StringHelper::Sprintf("\t\"%s\"", strData.data());
|
return StringHelper::Sprintf("\t\"%s\"", strData.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ZString::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix)
|
std::string ZString::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix, std::set<std::string> *nameSet)
|
||||||
{
|
{
|
||||||
return StringHelper::Sprintf("#define %s_macro \"%s\"", name.c_str(), strData.data());
|
return StringHelper::Sprintf("#define %s_macro \"%s\"", name.c_str(), strData.data());
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public:
|
|||||||
Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override;
|
Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override;
|
||||||
std::string GetBodySourceCode() const override;
|
std::string GetBodySourceCode() const override;
|
||||||
|
|
||||||
std::string GetSourceOutputHeader(const std::string& prefix) override;
|
std::string GetSourceOutputHeader(const std::string& prefix, std::set<std::string> *nameSet) override;
|
||||||
std::string GetSourceTypeName() const override;
|
std::string GetSourceTypeName() const override;
|
||||||
ZResourceType GetResourceType() const override;
|
ZResourceType GetResourceType() const override;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ size_t ZSymbol::GetRawDataSize() const
|
|||||||
return typeSize;
|
return typeSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ZSymbol::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix)
|
std::string ZSymbol::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix, std::set<std::string> *nameSet)
|
||||||
{
|
{
|
||||||
if (isArray)
|
if (isArray)
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
|
|
||||||
Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override;
|
Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override;
|
||||||
|
|
||||||
std::string GetSourceOutputHeader(const std::string& prefix) override;
|
std::string GetSourceOutputHeader(const std::string& prefix, std::set<std::string> *nameSet) override;
|
||||||
|
|
||||||
std::string GetSourceTypeName() const override;
|
std::string GetSourceTypeName() const override;
|
||||||
ZResourceType GetResourceType() const override;
|
ZResourceType GetResourceType() const override;
|
||||||
|
@ -17,12 +17,23 @@ WARN := -Wall -Wextra -Werror \
|
|||||||
-Wno-unused-function \
|
-Wno-unused-function \
|
||||||
-Wno-parentheses \
|
-Wno-parentheses \
|
||||||
-Wno-narrowing \
|
-Wno-narrowing \
|
||||||
-Wno-error=stringop-overflow \
|
|
||||||
-Wno-missing-field-initializers \
|
-Wno-missing-field-initializers \
|
||||||
-Wno-error=multichar
|
-Wno-error=multichar \
|
||||||
|
-Wno-unused-command-line-argument \
|
||||||
|
-Wno-delete-non-abstract-non-virtual-dtor \
|
||||||
|
-Wno-unused-private-field \
|
||||||
|
-Wno-deprecated-copy-with-user-provided-copy \
|
||||||
|
-Wno-deprecated-declarations \
|
||||||
|
-Wno-unknown-warning-option
|
||||||
|
|
||||||
CWARN :=
|
CWARN :=
|
||||||
CXXWARN := -Wno-deprecated-enum-enum-conversion -Wno-error=maybe-uninitialized
|
CXXWARN := -Wno-deprecated-enum-enum-conversion -Wno-deprecated-copy
|
||||||
|
|
||||||
|
COMPILER_VERSION := $(shell $(CXX) --version)
|
||||||
|
ifneq '' '$(findstring g++,$(COMPILER_VERSION))'
|
||||||
|
WARN += -Wno-error=stringop-overflow
|
||||||
|
CXXWARN += -Wno-error=maybe-uninitialized
|
||||||
|
endif
|
||||||
|
|
||||||
CXXFLAGS := $(WARN) $(CXXWARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
|
CXXFLAGS := $(WARN) $(CXXWARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
|
||||||
CFLAGS := $(WARN) $(CWARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
|
CFLAGS := $(WARN) $(CWARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
|
||||||
@ -32,6 +43,10 @@ ifeq ($(UNAME), Darwin) #APPLE
|
|||||||
CPPFLAGS += $(shell pkg-config --cflags sdl2 glew) -framework OpenGL
|
CPPFLAGS += $(shell pkg-config --cflags sdl2 glew) -framework OpenGL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(UNAME), Linux)
|
||||||
|
WARN += -Wno-error=stringop-overflow # This is required with clang on Linux.
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(DEBUG),0)
|
ifneq ($(DEBUG),0)
|
||||||
CXXFLAGS += -g -D_DEBUG
|
CXXFLAGS += -g -D_DEBUG
|
||||||
CFLAGS += -g -D_DEBUG
|
CFLAGS += -g -D_DEBUG
|
||||||
|
@ -28,7 +28,7 @@ static bool ClearCommand(const std::vector<std::string>&) {
|
|||||||
|
|
||||||
std::string toLowerCase(std::string in) {
|
std::string toLowerCase(std::string in) {
|
||||||
std::string cpy(in);
|
std::string cpy(in);
|
||||||
std::ranges::transform(cpy, cpy.begin(), [](unsigned char c) { return std::tolower(c); });
|
std::transform(cpy.begin(), cpy.end(), cpy.begin(), ::tolower);
|
||||||
return cpy;
|
return cpy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,11 +204,11 @@ void Console::Draw() {
|
|||||||
for (int i = 0; i < static_cast<int>(channel.size()); i++) {
|
for (int i = 0; i < static_cast<int>(channel.size()); i++) {
|
||||||
ConsoleLine line = channel[i];
|
ConsoleLine line = channel[i];
|
||||||
if(!this->filter.empty() && line.text.find(this->filter) == std::string::npos) continue;
|
if(!this->filter.empty() && line.text.find(this->filter) == std::string::npos) continue;
|
||||||
if(this->level_filter != NULLSTR && line.priority != (std::ranges::find(priority_filters, this->level_filter) - priority_filters.begin()) - 1) continue;
|
if(this->level_filter != NULLSTR && line.priority != (std::find(priority_filters.begin(), priority_filters.end(), this->level_filter) - priority_filters.begin()) - 1) continue;
|
||||||
std::string id = line.text + "##" + std::to_string(i);
|
std::string id = line.text + "##" + std::to_string(i);
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableSetColumnIndex(0);
|
||||||
const bool is_selected = (this->selectedId == i) || std::ranges::find(this->selectedEntries, i) != this->selectedEntries.end();
|
const bool is_selected = (this->selectedId == i) || std::find(this->selectedEntries.begin(), this->selectedEntries.end(), i) != this->selectedEntries.end();
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, this->priority_colors[line.priority]);
|
ImGui::PushStyleColor(ImGuiCol_Text, this->priority_colors[line.priority]);
|
||||||
if (ImGui::Selectable(id.c_str(), is_selected)) {
|
if (ImGui::Selectable(id.c_str(), is_selected)) {
|
||||||
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftCtrl)) && !is_selected)
|
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftCtrl)) && !is_selected)
|
||||||
|
@ -1246,7 +1246,7 @@ namespace SohImGui {
|
|||||||
if (ImGui::BeginMenu(category.first.c_str())) {
|
if (ImGui::BeginMenu(category.first.c_str())) {
|
||||||
for (const std::string& name : category.second) {
|
for (const std::string& name : category.second) {
|
||||||
std::string varName(name);
|
std::string varName(name);
|
||||||
varName.erase(std::ranges::remove_if(varName, isspace).begin(), varName.end());
|
varName.erase(std::remove_if(varName.begin(), varName.end(), [](unsigned char x) { return std::isspace(x); }), varName.end());
|
||||||
std::string toggleName = "g" + varName + "Enabled";
|
std::string toggleName = "g" + varName + "Enabled";
|
||||||
|
|
||||||
EnhancementCheckbox(name.c_str(), toggleName.c_str());
|
EnhancementCheckbox(name.c_str(), toggleName.c_str());
|
||||||
|
@ -566,7 +566,7 @@ static bool gfx_texture_cache_lookup(int i, int tile) {
|
|||||||
static void gfx_texture_cache_delete(const uint8_t* orig_addr)
|
static void gfx_texture_cache_delete(const uint8_t* orig_addr)
|
||||||
{
|
{
|
||||||
while (gfx_texture_cache.map.bucket_count() > 0) {
|
while (gfx_texture_cache.map.bucket_count() > 0) {
|
||||||
TextureCacheKey key = { orig_addr, 0, 0, 0 }; // bucket index only depends on the address
|
TextureCacheKey key = { orig_addr, {0}, 0, 0 }; // bucket index only depends on the address
|
||||||
size_t bucket = gfx_texture_cache.map.bucket(key);
|
size_t bucket = gfx_texture_cache.map.bucket(key);
|
||||||
bool again = false;
|
bool again = false;
|
||||||
for (auto it = gfx_texture_cache.map.begin(bucket); it != gfx_texture_cache.map.end(bucket); ++it) {
|
for (auto it = gfx_texture_cache.map.begin(bucket); it != gfx_texture_cache.map.end(bucket); ++it) {
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
#include "mixer.h"
|
#include "mixer.h"
|
||||||
|
|
||||||
|
#ifndef __clang__
|
||||||
#pragma GCC optimize ("unroll-loops")
|
#pragma GCC optimize ("unroll-loops")
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ROUND_UP_64(v) (((v) + 63) & ~63)
|
#define ROUND_UP_64(v) (((v) + 63) & ~63)
|
||||||
#define ROUND_UP_32(v) (((v) + 31) & ~31)
|
#define ROUND_UP_32(v) (((v) + 31) & ~31)
|
||||||
@ -449,10 +451,14 @@ void aFilterImpl(uint8_t flags, uint16_t count_or_buf, int16_t *state_or_filter)
|
|||||||
int16_t *buf = BUF_S16(count_or_buf);
|
int16_t *buf = BUF_S16(count_or_buf);
|
||||||
|
|
||||||
if (flags == A_INIT) {
|
if (flags == A_INIT) {
|
||||||
|
#ifndef __clang__
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wmemset-elt-size"
|
#pragma GCC diagnostic ignored "-Wmemset-elt-size"
|
||||||
|
#endif
|
||||||
memset(tmp, 0, 8 * sizeof(int16_t));
|
memset(tmp, 0, 8 * sizeof(int16_t));
|
||||||
|
#ifndef __clang__
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
memset(tmp2, 0, 8 * sizeof(int16_t));
|
memset(tmp2, 0, 8 * sizeof(int16_t));
|
||||||
} else {
|
} else {
|
||||||
memcpy(tmp, state_or_filter, 8 * sizeof(int16_t));
|
memcpy(tmp, state_or_filter, 8 * sizeof(int16_t));
|
||||||
|
10
soh/Makefile
10
soh/Makefile
@ -18,8 +18,11 @@ LTO ?= 0
|
|||||||
|
|
||||||
WARN := \
|
WARN := \
|
||||||
-Wno-return-type \
|
-Wno-return-type \
|
||||||
|
-Wno-unused-command-line-argument \
|
||||||
|
-Wno-implicit-function-declaration \
|
||||||
|
-Wno-c++11-narrowing \
|
||||||
-funsigned-char \
|
-funsigned-char \
|
||||||
-fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv \
|
-fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -ffreestanding -fwrapv \
|
||||||
|
|
||||||
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib
|
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib
|
||||||
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib
|
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib
|
||||||
@ -99,7 +102,6 @@ LDLIBS := \
|
|||||||
bz2 \
|
bz2 \
|
||||||
z \
|
z \
|
||||||
pthread \
|
pthread \
|
||||||
atomic \
|
|
||||||
ultraship \
|
ultraship \
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -116,7 +118,7 @@ endif
|
|||||||
|
|
||||||
ifeq ($(UNAME), Darwin) #APPLE
|
ifeq ($(UNAME), Darwin) #APPLE
|
||||||
LDLIBS += \
|
LDLIBS += \
|
||||||
$(addprefix -framework, \
|
$(addprefix -framework , \
|
||||||
OpenGL \
|
OpenGL \
|
||||||
) \
|
) \
|
||||||
$(shell sdl2-config --libs) $(shell pkg-config --libs glew)
|
$(shell sdl2-config --libs) $(shell pkg-config --libs glew)
|
||||||
@ -208,7 +210,7 @@ build/%.o: %.c
|
|||||||
$(TARGET): $(LIBULTRASHIP)
|
$(TARGET): $(LIBULTRASHIP)
|
||||||
|
|
||||||
$(TARGET): $(O_FILES)
|
$(TARGET): $(O_FILES)
|
||||||
$(CXX) $^ -o $@ $(LDFLAGS) -fuse-ld=$(LD) $(LDDIRS) $(LDLIBS)
|
$(CXX) $^ -o $@ $(LDFLAGS) $(LDDIRS) $(LDLIBS)
|
||||||
|
|
||||||
-include $(D_FILES)
|
-include $(D_FILES)
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <ultra64.h>
|
#include <ultra64.h>
|
||||||
#include <functions.h>
|
#include <functions.h>
|
||||||
#include <variables.h>
|
#include <variables.h>
|
||||||
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
#include <ultra64/gbi.h>
|
#include <ultra64/gbi.h>
|
||||||
|
@ -509,7 +509,7 @@ void DebugConsole_LoadCVars()
|
|||||||
if (cfg.size() < 2) continue;
|
if (cfg.size() < 2) continue;
|
||||||
if (cfg[1].find("\"") != std::string::npos) {
|
if (cfg[1].find("\"") != std::string::npos) {
|
||||||
std::string value(cfg[1]);
|
std::string value(cfg[1]);
|
||||||
value.erase(std::ranges::remove(value, '\"').begin(), value.end());
|
value.erase(std::remove(value.begin(), value.end(), '\"'), value.end());
|
||||||
CVar_SetString(cfg[0].c_str(), ImStrdup(value.c_str()));
|
CVar_SetString(cfg[0].c_str(), ImStrdup(value.c_str()));
|
||||||
}
|
}
|
||||||
if (is_number<float>(cfg[1])) {
|
if (is_number<float>(cfg[1])) {
|
||||||
|
@ -194,9 +194,9 @@ void CreateSphereFace(std::vector<std::tuple<size_t, size_t, size_t>>& faces, in
|
|||||||
|
|
||||||
// Create 3 new verticies at the midpoints
|
// Create 3 new verticies at the midpoints
|
||||||
Vec3f vs[3] = {
|
Vec3f vs[3] = {
|
||||||
Vec3f((v0.n.ob[0] + v1.n.ob[0]) / 2.0f, (v0.n.ob[1] + v1.n.ob[1]) / 2.0f, (v0.n.ob[2] + v1.n.ob[2]) / 2.0f),
|
Vec3f{(v0.n.ob[0] + v1.n.ob[0]) / 2.0f, (v0.n.ob[1] + v1.n.ob[1]) / 2.0f, (v0.n.ob[2] + v1.n.ob[2]) / 2.0f},
|
||||||
Vec3f((v1.n.ob[0] + v2.n.ob[0]) / 2.0f, (v1.n.ob[1] + v2.n.ob[1]) / 2.0f, (v1.n.ob[2] + v2.n.ob[2]) / 2.0f),
|
Vec3f{(v1.n.ob[0] + v2.n.ob[0]) / 2.0f, (v1.n.ob[1] + v2.n.ob[1]) / 2.0f, (v1.n.ob[2] + v2.n.ob[2]) / 2.0f},
|
||||||
Vec3f((v2.n.ob[0] + v0.n.ob[0]) / 2.0f, (v2.n.ob[1] + v0.n.ob[1]) / 2.0f, (v2.n.ob[2] + v0.n.ob[2]) / 2.0f)
|
Vec3f{(v2.n.ob[0] + v0.n.ob[0]) / 2.0f, (v2.n.ob[1] + v0.n.ob[1]) / 2.0f, (v2.n.ob[2] + v0.n.ob[2]) / 2.0f}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Normalize vertex positions so they are on the sphere
|
// Normalize vertex positions so they are on the sphere
|
||||||
@ -221,20 +221,20 @@ void CreateSphereData() {
|
|||||||
float d = (1.0f + sqrtf(5.0f)) / 2.0f;
|
float d = (1.0f + sqrtf(5.0f)) / 2.0f;
|
||||||
|
|
||||||
// Create the 12 starting verticies, 4 on each rectangle
|
// Create the 12 starting verticies, 4 on each rectangle
|
||||||
base.emplace_back(-1, d, 0);
|
base.emplace_back(Vec3f({-1, d, 0}));
|
||||||
base.emplace_back(1, d, 0);
|
base.emplace_back(Vec3f({1, d, 0}));
|
||||||
base.emplace_back(-1, -d, 0);
|
base.emplace_back(Vec3f({-1, -d, 0}));
|
||||||
base.emplace_back(1, -d, 0);
|
base.emplace_back(Vec3f({1, -d, 0}));
|
||||||
|
|
||||||
base.emplace_back(0, -1, d);
|
base.emplace_back(Vec3f({0, -1, d}));
|
||||||
base.emplace_back(0, 1, d);
|
base.emplace_back(Vec3f({0, 1, d}));
|
||||||
base.emplace_back(0, -1, -d);
|
base.emplace_back(Vec3f({0, -1, -d}));
|
||||||
base.emplace_back(0, 1, -d);
|
base.emplace_back(Vec3f({0, 1, -d}));
|
||||||
|
|
||||||
base.emplace_back(d, 0, -1);
|
base.emplace_back(Vec3f({d, 0, -1}));
|
||||||
base.emplace_back(d, 0, 1);
|
base.emplace_back(Vec3f({d, 0, 1}));
|
||||||
base.emplace_back(-d, 0, -1);
|
base.emplace_back(Vec3f({-d, 0, -1}));
|
||||||
base.emplace_back(-d, 0, 1);
|
base.emplace_back(Vec3f({-d, 0, 1}));
|
||||||
|
|
||||||
// Normalize verticies so they are on the unit sphere
|
// Normalize verticies so they are on the unit sphere
|
||||||
for (Vec3f& v : base) {
|
for (Vec3f& v : base) {
|
||||||
|
@ -185,17 +185,17 @@ typedef struct {
|
|||||||
|
|
||||||
// Maps quest items ids to info for use in ImGui
|
// Maps quest items ids to info for use in ImGui
|
||||||
std::map<uint32_t, QuestMapEntry> questMapping = {
|
std::map<uint32_t, QuestMapEntry> questMapping = {
|
||||||
QUEST_MAP_ENTRY(QUEST_MEDALLION_FOREST, gForestMedallionIconTex),
|
QUEST_MAP_ENTRY(QUEST_MEDALLION_FOREST, dgForestMedallionIconTex),
|
||||||
QUEST_MAP_ENTRY(QUEST_MEDALLION_FIRE, gFireMedallionIconTex),
|
QUEST_MAP_ENTRY(QUEST_MEDALLION_FIRE, dgFireMedallionIconTex),
|
||||||
QUEST_MAP_ENTRY(QUEST_MEDALLION_WATER, gWaterMedallionIconTex),
|
QUEST_MAP_ENTRY(QUEST_MEDALLION_WATER, dgWaterMedallionIconTex),
|
||||||
QUEST_MAP_ENTRY(QUEST_MEDALLION_SPIRIT, gSpiritMedallionIconTex),
|
QUEST_MAP_ENTRY(QUEST_MEDALLION_SPIRIT, dgSpiritMedallionIconTex),
|
||||||
QUEST_MAP_ENTRY(QUEST_MEDALLION_SHADOW, gShadowMedallionIconTex),
|
QUEST_MAP_ENTRY(QUEST_MEDALLION_SHADOW, dgShadowMedallionIconTex),
|
||||||
QUEST_MAP_ENTRY(QUEST_MEDALLION_LIGHT, gLightMedallionIconTex),
|
QUEST_MAP_ENTRY(QUEST_MEDALLION_LIGHT, dgLightMedallionIconTex),
|
||||||
QUEST_MAP_ENTRY(QUEST_KOKIRI_EMERALD, gKokiriEmeraldIconTex),
|
QUEST_MAP_ENTRY(QUEST_KOKIRI_EMERALD, dgKokiriEmeraldIconTex),
|
||||||
QUEST_MAP_ENTRY(QUEST_GORON_RUBY, gGoronRubyIconTex),
|
QUEST_MAP_ENTRY(QUEST_GORON_RUBY, dgGoronRubyIconTex),
|
||||||
QUEST_MAP_ENTRY(QUEST_ZORA_SAPPHIRE, gZoraSapphireIconTex),
|
QUEST_MAP_ENTRY(QUEST_ZORA_SAPPHIRE, dgZoraSapphireIconTex),
|
||||||
QUEST_MAP_ENTRY(QUEST_STONE_OF_AGONY, gStoneOfAgonyIconTex),
|
QUEST_MAP_ENTRY(QUEST_STONE_OF_AGONY, dgStoneOfAgonyIconTex),
|
||||||
QUEST_MAP_ENTRY(QUEST_GERUDO_CARD, gGerudosCardIconTex),
|
QUEST_MAP_ENTRY(QUEST_GERUDO_CARD, dgGerudosCardIconTex),
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -1330,17 +1330,17 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void bswapSoundFontSound(SoundFontSound* swappable) {
|
extern "C" void bswapSoundFontSound(SoundFontSound* swappable) {
|
||||||
swappable->sample = (SoundFontSample*)BOMSWAP32((u32)swappable->sample);
|
swappable->sample = (SoundFontSample*)BOMSWAP32((u32)(uintptr_t(swappable->sample)));
|
||||||
swappable->tuningAsU32 = BOMSWAP32((u32)swappable->tuningAsU32);
|
swappable->tuningAsU32 = BOMSWAP32((u32)(swappable->tuningAsU32 & 0xFFFFFFFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void bswapDrum(Drum* swappable) {
|
extern "C" void bswapDrum(Drum* swappable) {
|
||||||
bswapSoundFontSound(&swappable->sound);
|
bswapSoundFontSound(&swappable->sound);
|
||||||
swappable->envelope = (AdsrEnvelope*)BOMSWAP32((u32)swappable->envelope);
|
swappable->envelope = (AdsrEnvelope*)BOMSWAP32((u32)uintptr_t(swappable->envelope));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void bswapInstrument(Instrument* swappable) {
|
extern "C" void bswapInstrument(Instrument* swappable) {
|
||||||
swappable->envelope = (AdsrEnvelope*)BOMSWAP32((u32)swappable->envelope);
|
swappable->envelope = (AdsrEnvelope*)BOMSWAP32((u32)uintptr_t(swappable->envelope));
|
||||||
bswapSoundFontSound(&swappable->lowNotesSound);
|
bswapSoundFontSound(&swappable->lowNotesSound);
|
||||||
bswapSoundFontSound(&swappable->normalNotesSound);
|
bswapSoundFontSound(&swappable->normalNotesSound);
|
||||||
bswapSoundFontSound(&swappable->highNotesSound);
|
bswapSoundFontSound(&swappable->highNotesSound);
|
||||||
@ -1355,9 +1355,9 @@ extern "C" void bswapSoundFontSample(SoundFontSample* swappable) {
|
|||||||
swappable->unk_bit25 = (origBitfield >> 21) & 0x01;
|
swappable->unk_bit25 = (origBitfield >> 21) & 0x01;
|
||||||
swappable->size = (origBitfield) & 0x00FFFFFF;
|
swappable->size = (origBitfield) & 0x00FFFFFF;
|
||||||
|
|
||||||
swappable->sampleAddr = (u8*)BOMSWAP32((u32)swappable->sampleAddr);
|
swappable->sampleAddr = (u8*)BOMSWAP32((u32)uintptr_t(swappable->sampleAddr));
|
||||||
swappable->loop = (AdpcmLoop*)BOMSWAP32((u32)swappable->loop);
|
swappable->loop = (AdpcmLoop*)BOMSWAP32((u32)uintptr_t(swappable->loop));
|
||||||
swappable->book = (AdpcmBook*)BOMSWAP32((u32)swappable->book);
|
swappable->book = (AdpcmBook*)BOMSWAP32((u32)uintptr_t(swappable->book));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void bswapAdpcmLoop(AdpcmLoop* swappable) {
|
extern "C" void bswapAdpcmLoop(AdpcmLoop* swappable) {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <math.h>
|
||||||
#include "z64.h"
|
#include "z64.h"
|
||||||
|
|
||||||
void guMtxF2L(float mf[4][4], Mtx* m) {
|
void guMtxF2L(float mf[4][4], Mtx* m) {
|
||||||
@ -84,4 +85,4 @@ void guNormalize(f32* x, f32* y, f32* z) {
|
|||||||
*x = *x * tmp;
|
*x = *x * tmp;
|
||||||
*y = *y * tmp;
|
*y = *y * tmp;
|
||||||
*z = *z * tmp;
|
*z = *z * tmp;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <string.h>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "vt.h"
|
#include "vt.h"
|
||||||
|
|
||||||
@ -9,6 +10,9 @@ ViMode sViMode;
|
|||||||
FaultClient sGameFaultClient;
|
FaultClient sGameFaultClient;
|
||||||
u16 sLastButtonPressed;
|
u16 sLastButtonPressed;
|
||||||
|
|
||||||
|
// Forward declared, because this in a C++ header.
|
||||||
|
int gfx_create_framebuffer(uint32_t width, uint32_t height);
|
||||||
|
|
||||||
void GameState_FaultPrint(void) {
|
void GameState_FaultPrint(void) {
|
||||||
static char sBtnChars[] = "ABZSuldr*+LRudlr";
|
static char sBtnChars[] = "ABZSuldr*+LRudlr";
|
||||||
s32 i;
|
s32 i;
|
||||||
|
@ -33,6 +33,8 @@ void Title_PrintBuildInfo(Gfx** gfxp) {
|
|||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
GfxPrint_Printf(&printer, "MSVC SHIP");
|
GfxPrint_Printf(&printer, "MSVC SHIP");
|
||||||
|
#elif __clang__
|
||||||
|
GfxPrint_Printf(&printer, "CLANG SHIP");
|
||||||
#else
|
#else
|
||||||
GfxPrint_Printf(&printer, "GCC SHIP");
|
GfxPrint_Printf(&printer, "GCC SHIP");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user