Files
Yanis 8d925db967 Match HBM library (#93)
* started ut_ResFont.cpp

* match ut_ResFontBase.cpp

* start ut_TextWriterBase.cpp

* match HBMFrameController.cpp

* remove useless comments

* format

* new headers

* progress

* progressn't

* add bte headers from wii sports

* prog

* exclude bte from formatter

* match hbmcontroller.cpp and link ut_tagprocessorbase.cpp

* progressn't

* match HBMRemoteSpk.cpp

* format

* started db stuff and matched ut_list.cpp

* format

* progress

* complete ut splits

* format

* config link order based on strings

* start HBMBase.cpp

* layout splits

* solve some layout mystery files

* format

* debug module splits

* format

* snd split progress

* snd split progress

* match some files

* match some files 2

* progressn't

* format and progress on HBMBase

* link framecontroller

* link lyt_animation

* named some funcs and matched a file

* uh

* redo db but better!

* format and remove tabs

* nw4r -> nw4hbm

* cleanup panic macros

* remove useless files

* fix build/matching issues

* NW4HBMAssertHeaderRange -> NW4HBMAssertHeaderRangeValue

* db progress

* match directprint

* mapfile progress

* unnamed func to db::Warning

* match db_assert.cpp

* format

* a symbol!

* match DoDrawConsole

* match ut_resfont

* match lyt_bounding

* symbols splits and lyt_arcresourceaccessor progress

* match lyt_common

* match lyt_drawinfo

* match lyt_group

* run dol-apply

* match lyt_layout

* run dol-apply

* lyt_material progress

* more lyt_material progress

* match lyt_pane (but can't link it yet...)

* more progress

* missing include

* syms

* lyt_textbox prog

* window and textbox progress

* ut_TextWriterBase prog

* match ut_textwriterbase (but function order issues)

* match ut *Stream files

* run dol-apply

* snd progress

* more snd splits

* more more snd splits

* more more more snd splits

* even more snd splits

* more even more snd splits

* fix typo

* symbol fix

* completed snd splits!

* progress on axmanager

* match axmanager .text

* almost match axvoice .text

* match bank

* match bankfile

* match basicsound

* fix envgenerator

* match channel

* I'm stupid (forgot to commit the source of previously matched files)

* match disposecallbackmanager

* match dvdsoundarchive

* match externsoundplayer .text

* match externalsoundplayer and frameheap

* match instancepool

* match lfo

* match memorysoundarchive

* solve midi mystery

* match mmlparser

* match both MmlSeq files

* match nandsoundarchive

* match remotespeaker and remotespeakermanager

* match axvoice and fix some build issues

* prog

* Merge build issues fix branch

* fix headers

* fixed helpRVL

* snd_SoundArchivePlayer splits

* match seqfile

* run dol-apply

* almost match seqplayer

* match seqsoundhandle

* Match db_console.cpp .text

* match db_console .data

* match seqplayer

* link axvoice

* match seqsound

* match seqtrack

* dol apply

* match soundarchive

* match soundarchivefile

* dol apply

* match soundarchiveloader

* match soundhandle

* match soundheap

* match soundplayer

* dol apply

* match soundstartable

* match soundsystem

* match soundthread

* dol apply

* match strmchannel

* match strmfile

* match strmplayer 1

* match strmplayer 2 (vtable issues)

* mark soundhandle as matched

* match strmsound

* match taskmanager

* match taskthread

* match util

* match wavefile

* match waveplayer

* match wavesound

* match wavesoundhandle

* match wsdfile

* match wsdplayer and fix vtable issues

* dol apply

* match wsdtrack

* improve lyt_pane data

* Match more of snd_SoundArchivePlayer

* soundarchiveplayer vtable improvements

* remove unused source

* run format

* alignas -> ATTRIBUTE_ALIGN (for consistency) + build fix

* header cleanup: db files

* header cleanup: ut files

* header cleanup: math files

* header cleanup: lyt files

* header cleanup: remaining files

* fix hbmguimanager

* header cleanup: snd files

* run format

* header cleanup: misc files

* cleanup hbmassert

* remove useless comments + format

* source cleanup 1

* more cleanup

* match lyt_picture

* match lyt_textbox

* dol apply

* more cleanup

* run formatter

* link lyt_pane

* cleanup and link lyt_arcresourceacccessor

* match lyt_material .text

* match Window::Window

* match snd_axmanager

* dol apply

* match hbmanmcontroller

* hbmbase progress

* more hbmbase progress

* hbmbase progress

* more hbmbase progress

* hbmbase progress

* equivalent hbmbase

* match hbmbase

* fix build issues and link hbmbase

* dol-apply

* MATCH SND_SOUNDARCHIVEPLAYER!!!!!!!!!!!!!!

* format

* fill data gap

* cleanup pass 1

* cleanup pass 2

* format

* cleanup pass 3

* format

* cleanup pass 4

* cleanup pass 5

* hbmbase cleanup

* format

* `sizeof foo` -> `sizeof(foo)`

* remove tabs

* name things in HBMBase and cleanup helpRVL

* splits and symbols for oot-u and oot-e

* dol apply

* fix build errors

* fix formatting issues

* revert unwanted changes

* remove bte headers

* revert unwanted libc changes

* missed a bte file

* revert ./format changes and small helpRVL changes

* review and cleanup strings in db_mapFile

---------

Co-authored-by: cadmic <cadmic24@gmail.com>
2025-10-03 21:06:41 +02:00

124 lines
3.8 KiB
C

#ifndef DECOMP_FORCE_H
#define DECOMP_FORCE_H
#include "macros.h"
/*******************************************************************************
* Configuration
*/
/* NOTE: This repo's <macros.h> defines "typeof" as a macro. If you aren't using
* it, Metrowerks compilers since 2.4.2 have exposed this feature through the
* keyword "__typeof__". Metrowerks compilers before this version are not
* currently supported.
*/
#ifndef typeof
#define typeof __typeof__
#endif
#define DF_TYPEOF typeof
/* NOTE: This repo's <macros.h> defines "static_assert" as a macro. If you
* aren't using it, Metrowerks compilers since 4.1 have exposed this feature
* through the keyword "__static_assert". Alternatively, a typedef-based version
* also works as a substitute for any compiler.
*/
#define DF_SWALLOW_SEMICOLON() static_assert(1, "")
/*******************************************************************************
* Macro helpers
*/
#define DF_CONCAT3_(a, b, c) a##b##c
#define DF_CONCAT3(a, b, c) DF_CONCAT3_(a, b, c)
#define DF_UNIQUE_IDENT(ident_) DF_CONCAT3(ident_, _, __LINE__)
#if defined(__clang__)
#define DF_SUPPRESS_WARNINGS() \
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wnull-dereference\"")
#define DF_UNSUPPRESS_WARNINGS() _Pragma("clang diagnostic pop")
#elif defined(__MWERKS__)
#pragma section RX ".decomp"
#define DF_SUPPRESS_WARNINGS() __attribute__((section(".decomp")))
#define DF_UNSUPPRESS_WARNINGS()
#else
#define DF_SUPPRESS_WARNINGS()
#define DF_UNSUPPRESS_WARNINGS()
#endif
/*******************************************************************************
* DECOMP_FORCE macro internals
*/
#define DF_FUNCTION_DECLARATOR_WITH_PROTO(ident_) \
extern void(ident_)(void); \
extern void(ident_)(void)
// this is done to prevent default promotion of arguments to variadic functions
#define DF_FUNCTION_CALL(ident_, arg_) \
extern void(ident_)(DF_TYPEOF(arg_)); \
(ident_)(arg_)
/*******************************************************************************
* DECOMP_FORCE macros
*/
/* Forcefully generate orphaned data, early references, or other shenanigans.
* Only works at file or namespace scope.
*
* Examples:
* DECOMP_FORCE(1.0f);
* DECOMP_FORCE("I am a string");
* DECOMP_FORCE(UI2D_CONSTANT);
*/
#define DECOMP_FORCE(arg_) \
DF_SUPPRESS_WARNINGS() \
DF_FUNCTION_DECLARATOR_WITH_PROTO(DF_UNIQUE_IDENT(DECOMP_FORCE)) { \
DF_FUNCTION_CALL(DF_UNIQUE_IDENT(DECOMP_FORCE_CALL), arg_); \
} \
DF_UNSUPPRESS_WARNINGS() \
DF_SWALLOW_SEMICOLON()
/* Forcefully instantiate a class's method. For method_, write it as you would
* an actual function call.
* Only works at file or namespace scope.
*
* If class_ uses commas outside of nested parentheses, you must enclose the
* entire argument in DF_TYPEOF(). If method_ uses commas outside of nested
* parentheses, they are handled via __VA_ARGS__.
*
* Examples:
* DECOMP_FORCE_CLASS_METHOD(Class1, ~Class1());
* DECOMP_FORCE_CLASS_METHOD(DF_TYPEOF(Class2<int, 1>), func<long, int>(2, 3));
* DECOMP_FORCE_CLASS_METHOD(Class3, operator ,(4));
*/
#if defined(__cplusplus)
#define DECOMP_FORCE_CLASS_METHOD(class_, ...) \
DECOMP_FORCE(((void)(static_cast<DF_TYPEOF(class_)*>(0)->__VA_ARGS__), 0))
#endif
/*******************************************************************************
* DECOMP_FORCE helpers
*/
// Conversion constants from integer to floating-point
extern signed int DECOMP_SI;
extern unsigned int DECOMP_UI;
#define SI2D_CONSTANT ((float)(DECOMP_SI))
#define UI2D_CONSTANT ((float)(DECOMP_UI))
// clang-format on
#endif // DECOMP_FORCE_H