Skip to content

Commit

Permalink
Match all 20-byte functions (#1474)
Browse files Browse the repository at this point in the history
  • Loading branch information
ribbanya authored Sep 29, 2024
1 parent d5d76fa commit 55c1974
Show file tree
Hide file tree
Showing 849 changed files with 3,112 additions and 1,352 deletions.
11 changes: 7 additions & 4 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ WhitespaceSensitiveMacros:
- 'CHECK'
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^".*?__static\.h"$'
Priority: -2
SortPriority: 0
- Regex: '^<platform\.h>$'
Priority: -1
Priority: -2
SortPriority: -7
- Regex: '^<placeholder\.h>$'
Priority: -2
SortPriority: -6
- Regex: '^"forward\.h"$'
Priority: -1
Expand All @@ -45,6 +45,9 @@ IncludeCategories:
- Regex: '^<(sysdolphin/)?baselib(/.*)?/forward\.h>$'
Priority: -1
SortPriority: -1
- Regex: '^".*\.static\.h"$'
Priority: 0
SortPriority: -1
- Regex: '^<(.*/)?forward\.h>$'
Priority: -1
SortPriority: -3
Expand Down
38 changes: 28 additions & 10 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,8 @@
from pathlib import Path
from typing import Iterator, List, Optional

from tools.project import (
Library,
Object,
ProgressCategory,
ProjectConfig,
calculate_progress,
generate_build,
is_windows,
)
from tools.project import (Library, Object, ProgressCategory, ProjectConfig,
calculate_progress, generate_build, is_windows)

# Game versions
DEFAULT_VERSION = 0
Expand Down Expand Up @@ -253,6 +246,21 @@
"-inline auto",
]

# MetroTRK flags
cflags_trk = [
*cflags_base,
"-use_lmw_stmw on",
"-str reuse,pool,readonly",
"-common off",
"-sdata 0",
"-sdata2 0",
"-fp hard",
"-enum int",
"-char unsigned",
"-inline deferred",
"-rostr",
]

includes_base = ["src"]

system_includes_base = [
Expand Down Expand Up @@ -393,6 +401,16 @@ def RuntimeLib(lib_name: str, objects: Objects) -> Library:
)


def TRKLib(lib_name: str, objects: Objects) -> Library:
return Lib(
lib_name,
objects,
cflags=cflags_trk,
fix_epilogue=False,
category="runtime",
)


Matching = True # Object matches and should be linked
NonMatching = False # Object does not match and should not be linked
Equivalent = (
Expand Down Expand Up @@ -1206,7 +1224,7 @@ def RuntimeLib(lib_name: str, objects: Objects) -> Library:
Object(NonMatching, "MSL/math.c"),
],
),
RuntimeLib(
TRKLib(
"MetroTRK (Metrowerks Target Resident Kernel)",
[
Object(NonMatching, "MetroTRK/mainloop.c"),
Expand Down
2 changes: 1 addition & 1 deletion src/MSL/buffer_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ s32 __flush_buffer(BufferIoUnkStruct* arg0, s32* arg1)
temp_r0 = arg0->x20 - arg0->x18;
if (temp_r0 != 0) {
arg0->x24 = temp_r0;
if (arg0->x05.bits.b4) {
if (arg0->x05.b4) {
arg0 != 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/MSL/buffer_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef struct _BufferIoUnkFlagStruct {
u8 b5 : 1;
u8 b6 : 1;
u8 b7 : 1;
} bits;
};
} BufferIoUnkFlagStruct;

typedef struct _BufferIoUnkStruct {
Expand Down
1 change: 1 addition & 0 deletions src/MSL/printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define GALE01_323CF0

#include <placeholder.h>

#include <stdarg.h>

/* 323CF0 */ UNK_RET __stdio_atexit(UNK_PARAMS);
Expand Down
10 changes: 10 additions & 0 deletions src/MetroTRK/dispatch.c
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#include "dispatch.h"

#include <MetroTRK/nubinit.h>

enum_t TRKInitializeDispatcher(void)
{
MTRK_NubInit_804A4B40 = 32;
return 0;
}

/// #TRKDispatchMessage
8 changes: 8 additions & 0 deletions src/MetroTRK/dispatch.h
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
#ifndef GALE01_3276A8
#define GALE01_3276A8

#include <placeholder.h>

/* 3276A8 */ enum_t TRKInitializeDispatcher(void);
/* 3276BC */ UNK_RET TRKDispatchMessage(UNK_PARAMS);

#endif
10 changes: 10 additions & 0 deletions src/MetroTRK/nubinit.c
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#include "nubinit.h"

/* 4A4B40 */ size_t MTRK_NubInit_804A4B40;

/// #TRKInitializeNub

/// #TRKTerminateNub

/// #TRKNubWelcome

/// #TRKInitializeEndian
11 changes: 11 additions & 0 deletions src/MetroTRK/nubinit.h
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
#ifndef GALE01_326AD8
#define GALE01_326AD8

#include <placeholder.h>

/* 326AD8 */ UNK_RET TRKInitializeNub(UNK_PARAMS);
/* 326BAC */ UNK_RET TRKTerminateNub(UNK_PARAMS);
/* 326BD0 */ UNK_RET TRKNubWelcome(UNK_PARAMS);
/* 326BF8 */ UNK_RET TRKInitializeEndian(UNK_PARAMS);
/* 4A4B40 */ extern size_t MTRK_NubInit_804A4B40;

#endif
4 changes: 2 additions & 2 deletions src/MetroTRK/targimpl.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "targimpl.h"

#include <placeholder.h>

#include "targimpl.h"

int __TRK_get_MSR(void)
{
#ifdef MWERKS_GEKKO
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/Gecko_setjmp.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <platform.h>
#include <placeholder.h>

#include <Gecko_setjmp.h>
#include <placeholder.h>

#ifdef MWERKS_GEKKO
asm int __setjmp(register __jmp_buf* env)
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/__init_cpp_exceptions.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <platform.h>
#include <placeholder.h>

#include <__init_cpp_exceptions.h>
#include <Gecko_ExceptionPPC.h>
#include <placeholder.h>

static int fragmentID = -2;

Expand Down
1 change: 1 addition & 0 deletions src/Runtime/__va_arg.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <placeholder.h>

#include <stdarg.h>

#ifdef __MWERKS__
Expand Down
5 changes: 3 additions & 2 deletions src/common_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#define _common_structs_h_

#include <platform.h>

#include <dolphin/gx/forward.h>

#include <dolphin/gx/types.h>
Expand Down Expand Up @@ -62,7 +63,7 @@ typedef u32 HSD_Pad;
#define MPCOLL_FLAGS_B24 (1 << 24)
#define MPCOLL_FLAGS_B25 (1 << 25)

typedef union _UnkFlagStruct {
typedef union UnkFlagStruct {
u8 u8;
struct {
u8 b0 : 1;
Expand All @@ -73,7 +74,7 @@ typedef union _UnkFlagStruct {
u8 b5 : 1;
u8 b6 : 1;
u8 b7 : 1;
} bits;
};
} UnkFlagStruct;

typedef struct ColorOverlay {
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/ai/ai.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <placeholder.h>

#include <dolphin/ai/ai.h>
#include <dolphin/dsp/dsp.h>
#include <dolphin/os/OSContext.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/ax/AXSPB.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define GALE01_359D8C

#include <placeholder.h>

#include <dolphin/ax.h>

/* 359D8C */ AXSPB* __AXGetStudio(void);
Expand Down
2 changes: 1 addition & 1 deletion src/dolphin/ax/AXVPB.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define GALE01_35A250

#include <platform.h>

#include <placeholder.h>

#include <dolphin/ax.h>

/* 35A250 */ u32 __AXGetNumVoices(void);
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/base/PPCArch.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <placeholder.h>

#include <dolphin/base/PPCArch.h>

#ifdef MWERKS_GEKKO
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_H

#include <platform.h>

#include <dolphin/card/forward.h>

#include <dolphin/dsp/dsp.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDBios.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDBIOS_H

#include <platform.h>

#include <dolphin/card/forward.h>

#include <dolphin/card.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDBLOCK_H

#include <platform.h>

#include <dolphin/card/forward.h>

#include <dolphin/card.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDCHECK_H

#include <platform.h>

#include <dolphin/card/forward.h>

#include <dolphin/card.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDCreate.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDCREATE_H

#include <platform.h>

#include <dolphin/card/forward.h>

s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size,
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDDelete.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDDELETE_H

#include <platform.h>

#include <dolphin/card/forward.h>

s32 CARDFastDeleteAsync(s32 chan, s32 fileNo, CARDCallback callback);
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDDir.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDDIR_H

#include <platform.h>

#include <dolphin/card/forward.h>

#include <dolphin/card.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDFORMAT_H

#include <platform.h>

#include <dolphin/card/forward.h>

void FormatCallback(s32 chan, s32 result);
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDMount.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDMOUNT_H

#include <platform.h>

#include <dolphin/card/forward.h>

#include <dolphin/os.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDOpen.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDOPEN_H

#include <platform.h>

#include <dolphin/card/forward.h>

#include <dolphin/card.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDRdwr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDRDWR_H

#include <platform.h>

#include <dolphin/card/forward.h>

#include <dolphin/card.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDRead.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDREAD_H

#include <platform.h>

#include <dolphin/card/forward.h>

#include <dolphin/card.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDRename.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDRENAME_H

#include <platform.h>

#include <dolphin/card/forward.h>

s32 CARDRenameAsync(s32 chan, const char* old, const char* new,
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDStat.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDSTAT_H

#include <platform.h>

#include <dolphin/card/forward.h>

s32 CARDGetStatus(s32 chan, s32 fileNo, CARDStat* stat);
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/card/CARDWrite.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOLPHIN_CARD_CARDWRITE_H

#include <platform.h>

#include <dolphin/card/forward.h>

s32 CARDWriteAsync(CARDFileInfo* fileInfo, const void* buf, u32 length,
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/db/db.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <placeholder.h>

#include <dolphin/base/PPCArch.h>
#include <dolphin/db/db.h>
#include <dolphin/os.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/dvd/dvd.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define __DOLPHIN_DVD_H_

#include <platform.h>

#include <dolphin/dvd/forward.h>

#include <dolphin/os/OSThread.h>
Expand Down
1 change: 1 addition & 0 deletions src/dolphin/dvd/dvdfs.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <platform.h>

#include <dolphin/dvd/forward.h>

#include <dolphin/dvd/dvd.h>
Expand Down
Loading

0 comments on commit 55c1974

Please sign in to comment.