Refactor to compile sources as C++

This commit is contained in:
Zac 2024-07-01 01:31:25 +00:00 committed by GitHub
parent 0317408fbc
commit 66d82f9b82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 44 additions and 43 deletions

View File

@ -41,11 +41,11 @@ GetBinocReticleFocus = 0x136EC8; // type:func
FUN_00136ef8 = 0x136EF8; // type:func
FUN_00136fa8 = 0x136FA8; // type:func
__static_initialization_and_destruction_0 = 0x136FE8; // type:func
CTextBox__SetPos = 0x137228; // type:func
CTextBox__SetSize = 0x137238; // type:func
CTextBox__SetTextColor = 0x137248; // type:func
CTextBox__SetHorizontalJust = 0x137260; // type:func
CTextBox__SetVerticalJust = 0x137268; // type:func
SetPos__8CTextBoxff = 0x137228; // type:func
SetSize__8CTextBoxff = 0x137238; // type:func
SetTextColor__8CTextBoxG4RGBA = 0x137248; // type:func
SetHorizontalJust__8CTextBox2JH = 0x137260; // type:func
SetVerticalJust__8CTextBox2JV = 0x137268; // type:func
_GLOBAL_$I$InitBei__FP3BEIP3CLQffi = 0x137270; // type:func
// P2/chkpnt.c
@ -73,8 +73,8 @@ FUN_00141870 = 0x141870; // type:func
SetClockRate = 0x142ED0; // type:func
MarkClockTick = 0x142F10; // type:func
MarkClockTickRealOnly = 0x143030; // type:func
ResetClock = 0x1430B8; // type:func
SetClockEnabled = 0x1430C0; // type:func
ResetClock__FP5CLOCKf = 0x1430B8; // type:func
SetClockEnabled__FP5CLOCKi = 0x1430C0; // type:func
StartupClock = 0x1430C8; // type:func
TickNow = 0x1430F8; // type:func
@ -89,7 +89,7 @@ FUN_001519e0 = 0x1519E0; // type:func
OnDifficultyGameLoad = 0x151A68; // type:func
OnDifficultyWorldPreLoad = 0x151A88; // type:func
OnDifficultyWorldPostLoad = 0x151D28; // type:func
OnDifficultyInitialTeleport = 0x151E18; // type:func
OnDifficultyInitialTeleport__FP10DIFFICULTY = 0x151E18; // type:func
OnDifficultyPlayerDeath = 0x151E20; // type:func
OnDifficultyTriggerCheckpoint = 0x151ED8; // type:func
OnDifficultyCollectKey = 0x151FC8; // type:func
@ -122,7 +122,7 @@ GTrunc = 0x1EAE78; // type:func
GTrunc1 = 0x1EAF28; // type:func
GModPositive = 0x1EAFE0; // type:func
FitClq = 0x1EB018; // type:func
FCheckLm = 0x1EB050; // type:func
FCheckLm__FP2LMf = 0x1EB050; // type:func
FCheckAlm = 0x1EB080; // type:func
GLimitLm = 0x1EB0F8; // type:func
SgnCompareG = 0x1EB128; // type:func

View File

@ -29,7 +29,7 @@ PRE_ELF_PATH = f"{OUTDIR}/{BASENAME}.elf"
COMMON_INCLUDES = "-Iinclude -isystem include/sdk/ee -isystem include/gcc"
CC_DIR = f"{TOOLS_DIR}/cc/ee-gcc2.9-991111/bin"
COMMON_COMPILE_FLAGS = "-O2 -G0"
COMMON_COMPILE_FLAGS = "-x c++ -O2 -G0 -fno-exceptions -fno-rtti"
WINE = "wine"

View File

@ -42,8 +42,16 @@ struct RGBA
uchar bAlpha;
};
struct CTextBox
class CTextBox
{
public:
void SetTextColor(RGBA* rgba);
void SetPos(float x, float y);
void SetSize(float dx, float dy);
void SetHorizontalJust(JH jh);
void SetVerticalJust(JV jv);
private:
float m_x;
float m_y;
float m_dx;
@ -53,9 +61,4 @@ struct CTextBox
enum JV m_jv;
};
void CTextBox__SetPos(struct CTextBox *this,float x,float y);
void CTextBox__SetSize(struct CTextBox *this,float dx,float dy);
void CTextBox__SetHorizontalJust(struct CTextBox* this, JH jh);
void CTextBox__SetVerticalJust(struct CTextBox* this, JV jv);
#endif /* BINOC_H */

View File

@ -25,8 +25,8 @@ struct CLOCK
};
void SetClockRate(float rt);
void ResetClock(struct CLOCK *pclock, float t);
void SetClockEnabled(struct CLOCK *pclock, int fEnabled);
void ResetClock(CLOCK *pclock, float t);
void SetClockEnabled(CLOCK *pclock, int fEnabled);
extern float g_rtClock;
extern float g_rtClockPowerUp;

View File

@ -74,7 +74,7 @@ extern struct DIFFICULTYLEVEL g_difficultyHard;
*
* @param pdifficulty Pointer to the difficulty.
*/
void OnDifficultyGameLoad(struct DIFFICULTY* pdifficulty);
void OnDifficultyGameLoad(DIFFICULTY* pdifficulty);
/**
* @brief Sets up the difficulty system.
@ -83,7 +83,7 @@ void OnDifficultyGameLoad(struct DIFFICULTY* pdifficulty);
*
* @param pdifficulty Pointer to the difficulty.
*/
void OnDifficultyWorldPreLoad(struct DIFFICULTY* pdifficulty);
void OnDifficultyWorldPreLoad(DIFFICULTY* pdifficulty);
/**
* @brief Called after a level is loaded to set up the difficulty system.
@ -92,14 +92,14 @@ void OnDifficultyWorldPreLoad(struct DIFFICULTY* pdifficulty);
*
* @param pdifficulty Pointer to the difficulty.
*/
void OnDifficultyWorldPostLoad(struct DIFFICULTY* pdifficulty);
void OnDifficultyWorldPostLoad(DIFFICULTY* pdifficulty);
/**
* @brief Stubbed, does nothing.
*
* @param pdifficulty Pointer to the difficulty.
*/
void OnDifficultyInitialTeleport(struct DIFFICULTY* pdifficulty);
void OnDifficultyInitialTeleport(DIFFICULTY* pdifficulty);
/**
* @brief Called when the player dies.
@ -119,7 +119,7 @@ void OnDifficultyPlayerDeath(float scalar, struct DIFFICULTY* pdifficulty);
* @param pdifficulty Pointer to the difficulty.
* @param pchkpnt Pointer to the checkpoint.
*/
void OnDifficultyTriggerCheckpoint(struct DIFFICULTY* pdifficulty, struct CHKPNT* pchkpnt);
void OnDifficultyTriggerCheckpoint(DIFFICULTY* pdifficulty, struct CHKPNT* pchkpnt);
/**
* @brief Called when the player collects a key.
@ -128,7 +128,7 @@ void OnDifficultyTriggerCheckpoint(struct DIFFICULTY* pdifficulty, struct CHKPNT
*
* @param pdifficulty Pointer to the difficulty.
*/
void OnDifficultyCollectKey(struct DIFFICULTY* pdifficulty);
void OnDifficultyCollectKey(DIFFICULTY* pdifficulty);
/**
* @brief Called when the player breaks something.
@ -137,7 +137,7 @@ void OnDifficultyCollectKey(struct DIFFICULTY* pdifficulty);
* @param ppos Pointer to the position of the breakable.
* @param ccoin The number of coins. (?)
*/
void OnDifficultyBreak(struct DIFFICULTY* pdifficulty, struct VECTOR* ppos, int ccoin);
void OnDifficultyBreak(DIFFICULTY* pdifficulty, struct VECTOR* ppos, int ccoin);
/**
* @brief Changes the suck value by the given amount.

View File

@ -6,6 +6,8 @@
#ifndef UTIL_H
#define UTIL_H
#include "common.h"
/**
* @brief Limits for a float.
*/
@ -27,11 +29,11 @@ struct VECTOR {
* @param plm Pointer to the limit
* @param g The float to check
*/
int FCheckLm(struct LM* plm, float g);
int FCheckLm(LM* plm, float g);
/**
* @brief Stubbed function, does nothing.
*/
void Force(void);
void Force();
#endif // UTIL_H

View File

@ -72,26 +72,26 @@ INCLUDE_ASM(const s32, "P2/binoc", FUN_00136fa8);
INCLUDE_ASM(const s32, "P2/binoc", __static_initialization_and_destruction_0);
void CTextBox__SetPos(struct CTextBox *this,float x,float y)
void CTextBox::SetPos(float x, float y)
{
this->m_x = x;
this->m_y = y;
}
void CTextBox__SetSize(struct CTextBox *this,float dx,float dy)
void CTextBox::SetSize(float dx, float dy)
{
this->m_dx = dx;
this->m_dy = dy;
}
INCLUDE_ASM(const s32, "P2/binoc", CTextBox__SetTextColor);
INCLUDE_ASM(const s32, "P2/binoc", SetTextColor__8CTextBoxG4RGBA);
void CTextBox__SetHorizontalJust(struct CTextBox* this, JH jh)
void CTextBox::SetHorizontalJust(JH jh)
{
this->m_jh = jh;
}
void CTextBox__SetVerticalJust(struct CTextBox* this, JV jv)
void CTextBox::SetVerticalJust(JV jv)
{
this->m_jv = jv;
}

View File

@ -11,12 +11,12 @@ INCLUDE_ASM(const s32, "P2/clock", MarkClockTick);
INCLUDE_ASM(const s32, "P2/clock", MarkClockTickRealOnly);
void ResetClock(struct CLOCK *pclock, float t)
void ResetClock(CLOCK *pclock, float t)
{
pclock->t = t;
}
void SetClockEnabled(struct CLOCK *pclock, int fEnabled)
void SetClockEnabled(CLOCK *pclock, int fEnabled)
{
pclock->fEnabled = fEnabled;
}
@ -24,7 +24,4 @@ void SetClockEnabled(struct CLOCK *pclock, int fEnabled)
INCLUDE_ASM(const s32, "P2/clock", StartupClock);
INCLUDE_ASM(const s32, "P2/clock", TickNow);
void func_00143140(void)
{
}
INCLUDE_ASM(const s32, "P2/clock", func_00143140); // empty, not really a function

View File

@ -9,8 +9,9 @@ INCLUDE_ASM(const s32, "P2/difficulty", OnDifficultyWorldPreLoad);
INCLUDE_ASM(const s32, "P2/difficulty", OnDifficultyWorldPostLoad);
void OnDifficultyInitialTeleport(struct DIFFICULTY* pdifficulty) {
void OnDifficultyInitialTeleport(DIFFICULTY* pdifficulty) {
// Stubbed, does nothing.
return;
}
INCLUDE_ASM(const s32, "P2/difficulty", OnDifficultyPlayerDeath);

View File

@ -1,4 +1,3 @@
#include "common.h"
#include <util.h>
INCLUDE_ASM(const s32, "P2/util", RadNormalize);
@ -40,7 +39,7 @@ INCLUDE_ASM(const s32, "P2/util", GModPositive);
INCLUDE_ASM(const s32, "P2/util", FitClq);
int FCheckLm(struct LM* plm, float g)
int FCheckLm(LM* plm, float g)
{
return (plm->gMin < g) && (g < plm->gMax);
}
@ -51,8 +50,7 @@ INCLUDE_ASM(const s32, "P2/util", GLimitLm);
INCLUDE_ASM(const s32, "P2/util", SgnCompareG);
void Force(void) {
}
INCLUDE_ASM(const s32, "P2/util", Force); // stubbed
INCLUDE_ASM(const s32, "P2/util", MinimizeRange);
INCLUDE_ASM(const s32, "P2/util", func_001EB458);