Skip to content

Commit

Permalink
Replace all C_ASSERT with ZUN_ASSERT_SIZE for portability
Browse files Browse the repository at this point in the history
  • Loading branch information
Renzo904 committed Dec 3, 2024
1 parent 348f0c4 commit 0b3fe22
Show file tree
Hide file tree
Showing 32 changed files with 89 additions and 82 deletions.
6 changes: 3 additions & 3 deletions src/AnmManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ struct AnmRawEntry
u32 spriteOffsets[10];
AnmRawScript scripts[10];
};
C_ASSERT(sizeof(AnmRawEntry) == 0xb8);
ZUN_ASSERT_SIZE(AnmRawEntry, 0xb8);

struct RenderVertexInfo
{
D3DXVECTOR3 position;
D3DXVECTOR2 textureUV;
};
C_ASSERT(sizeof(RenderVertexInfo) == 0x14);
ZUN_ASSERT_SIZE(RenderVertexInfo, 0x14);

struct AnmManager
{
Expand Down Expand Up @@ -215,7 +215,7 @@ struct AnmManager
i32 screenshotWidth;
i32 screenshotHeight;
};
C_ASSERT(sizeof(AnmManager) == 0x2112c);
ZUN_ASSERT_SIZE(AnmManager, 0x2112c);

DIFFABLE_EXTERN(AnmManager *, g_AnmManager);
DIFFABLE_EXTERN(D3DFORMAT, g_TextureFormatD3D8Mapping[6]);
Expand Down
4 changes: 2 additions & 2 deletions src/AnmVm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct AnmLoadedSprite
f32 widthPx;
i32 spriteId;
};
C_ASSERT(sizeof(AnmLoadedSprite) == 0x38);
ZUN_ASSERT_SIZE(AnmLoadedSprite, 0x38);

#define AnmOpcode_Exit 0
#define AnmOpcode_SetActiveSprite 1
Expand Down Expand Up @@ -206,5 +206,5 @@ struct AnmVm
u8 fontHeight;
// Two final padding bytes
};
C_ASSERT(sizeof(AnmVm) == 0x110);
ZUN_ASSERT_SIZE(AnmVm, 0x110);
}; // namespace th06
6 changes: 3 additions & 3 deletions src/AsciiManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct AsciiManagerString
// If true, we are drawing an element of the Gui class.
u32 isGui;
};
C_ASSERT(sizeof(AsciiManagerString) == 0x60);
ZUN_ASSERT_SIZE(AsciiManagerString, 0x60);

struct AsciiManagerPopup
{
Expand All @@ -36,7 +36,7 @@ struct AsciiManagerPopup
u8 inUse;
u8 characterCount;
};
C_ASSERT(sizeof(AsciiManagerPopup) == 0x28);
ZUN_ASSERT_SIZE(AsciiManagerPopup, 0x28);

struct WeirdPadding
{
Expand Down Expand Up @@ -105,6 +105,6 @@ struct AsciiManager
StageMenu retryMenu;
AsciiManagerPopup popups[515];
};
C_ASSERT(sizeof(AsciiManager) == 0xc1ac);
ZUN_ASSERT_SIZE(AsciiManager, 0xc1ac);
DIFFABLE_EXTERN(AsciiManager, g_AsciiManager);
}; // namespace th06
8 changes: 4 additions & 4 deletions src/BulletManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct BulletTypeSprites
u8 unk_55c;
u8 bulletHeight;
};
C_ASSERT(sizeof(BulletTypeSprites) == 0x560);
ZUN_ASSERT_SIZE(BulletTypeSprites, 0x560);

struct Bullet
{
Expand All @@ -63,7 +63,7 @@ struct Bullet
u8 unk_5c2;
u8 isGrazed;
};
C_ASSERT(sizeof(Bullet) == 0x5c4);
ZUN_ASSERT_SIZE(Bullet, 0x5c4);

struct Laser
{
Expand All @@ -87,7 +87,7 @@ struct Laser
i16 color;
u8 state;
};
C_ASSERT(sizeof(Laser) == 0x270);
ZUN_ASSERT_SIZE(Laser, 0x270);

struct BulletManager
{
Expand Down Expand Up @@ -119,7 +119,7 @@ struct BulletManager
ZunTimer time;
char *bulletAnmPath;
};
C_ASSERT(sizeof(BulletManager) == 0xf5c18);
ZUN_ASSERT_SIZE(BulletManager, 0xf5c18);

DIFFABLE_EXTERN(u32 *, g_EffectsColor);
DIFFABLE_EXTERN(BulletManager, g_BulletManager);
Expand Down
4 changes: 2 additions & 2 deletions src/Chain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ChainElem
ChainElem();
~ChainElem();
};
C_ASSERT(sizeof(ChainElem) == 0x20);
ZUN_ASSERT_SIZE(ChainElem, 0x20);

class Chain
{
Expand All @@ -66,7 +66,7 @@ class Chain

ChainElem *CreateElem(ChainCallback callback);
};
C_ASSERT(sizeof(Chain) == 0x48);
ZUN_ASSERT_SIZE(Chain, 0x48);

DIFFABLE_EXTERN(Chain, g_Chain)
}; // namespace th06
6 changes: 3 additions & 3 deletions src/EclManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ struct EclRawInstrEnemyCreateArgs
i16 itemDrop;
i32 score;
};
C_ASSERT(sizeof(EclRawInstrEnemyCreateArgs) == 0x18);
ZUN_ASSERT_SIZE(EclRawInstrEnemyCreateArgs, 0x18);

struct EclRawInstrAnmInterruptSlotArgs
{
Expand Down Expand Up @@ -344,7 +344,7 @@ struct EclRawHeader
EclTimelineInstr *timelineOffsets[3];
EclRawInstr *subOffsets[0];
};
C_ASSERT(sizeof(EclRawHeader) == 0x10);
ZUN_ASSERT_SIZE(EclRawHeader, 0x10);

enum EclRawInstrOpcode
{
Expand Down Expand Up @@ -497,7 +497,7 @@ struct EclManager
EclRawInstr **subTable;
EclTimelineInstr *timeline;
};
C_ASSERT(sizeof(EclManager) == 0xc);
ZUN_ASSERT_SIZE(EclManager, 0xc);

DIFFABLE_EXTERN(EclManager, g_EclManager);
}; // namespace th06
4 changes: 2 additions & 2 deletions src/Effect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ struct Effect
i8 unk_17a;
i8 unk_17b;
};
C_ASSERT(sizeof(Effect) == 0x17c);
ZUN_ASSERT_SIZE(Effect, 0x17c);

struct EffectInfo
{
i32 anmIdx;
EffectUpdateCallback updateCallback;
};
C_ASSERT(sizeof(EffectInfo) == 0x8);
ZUN_ASSERT_SIZE(EffectInfo, 0x8);
}; // namespace th06
2 changes: 1 addition & 1 deletion src/EffectManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct EffectManager
void Reset();
Effect *SpawnParticles(i32 effectIdx, D3DXVECTOR3 *pos, i32 count, ZunColor color);
};
C_ASSERT(sizeof(EffectManager) == 0x2f984);
ZUN_ASSERT_SIZE(EffectManager, 0x2f984);

DIFFABLE_EXTERN(EffectManager, g_EffectManager);
}; // namespace th06
2 changes: 1 addition & 1 deletion src/Ending.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ struct Ending
EndingFadeType fadeType;
char *endFileDataPtr;
};
C_ASSERT(sizeof(Ending) == 0x1170);
ZUN_ASSERT_SIZE(Ending, 0x1170);
}; // namespace th06
8 changes: 4 additions & 4 deletions src/Enemy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct EnemyBulletShooter
u32 flags;
SoundIdx sfx;
};
C_ASSERT(sizeof(EnemyBulletShooter) == 0x54);
ZUN_ASSERT_SIZE(EnemyBulletShooter, 0x54);

struct EnemyLaserShooter
{
Expand Down Expand Up @@ -71,7 +71,7 @@ struct EnemyLaserShooter
u32 flags;
u32 unk_50;
};
C_ASSERT(sizeof(EnemyLaserShooter) == 0x54);
ZUN_ASSERT_SIZE(EnemyLaserShooter, 0x54);

struct EnemyEclContext
{
Expand All @@ -93,7 +93,7 @@ struct EnemyEclContext
i32 compareRegister;
u16 subId;
};
C_ASSERT(sizeof(EnemyEclContext) == 0x4c);
ZUN_ASSERT_SIZE(EnemyEclContext, 0x4c);

struct EnemyFlags
{
Expand Down Expand Up @@ -259,5 +259,5 @@ struct Enemy
f32 exInsFunc6Angle;
ZunTimer exInsFunc6Timer;
};
C_ASSERT(sizeof(Enemy) == 0xec8);
ZUN_ASSERT_SIZE(Enemy, 0xec8);
}; // namespace th06
2 changes: 1 addition & 1 deletion src/EnemyEclInstr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct PatchouliShottypeVars
i32 var3;
} shotVars[2];
};
C_ASSERT(sizeof(PatchouliShottypeVars) == 0x18);
ZUN_ASSERT_SIZE(PatchouliShottypeVars, 0x18);

DIFFABLE_STATIC_ARRAY_ASSIGN(PatchouliShottypeVars, 2, g_PatchouliShottypeVars) = {{{{0, 3, 1}, {2, 3, 4}}},
{{{1, 4, 0}, {4, 2, 4}}}};
Expand Down
4 changes: 2 additions & 2 deletions src/EnemyManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct RunningSpellcardInfo
u32 idx;
ZunBool usedBomb;
};
C_ASSERT(sizeof(RunningSpellcardInfo) == 0x14);
ZUN_ASSERT_SIZE(RunningSpellcardInfo, 0x14);

struct EnemyManager
{
Expand Down Expand Up @@ -47,7 +47,7 @@ struct EnemyManager
EclTimelineInstr *timelineInstr;
ZunTimer timelineTime;
};
C_ASSERT(sizeof(EnemyManager) == 0xee5ec);
ZUN_ASSERT_SIZE(EnemyManager, 0xee5ec);

DIFFABLE_EXTERN(EnemyManager, g_EnemyManager)
}; // namespace th06
2 changes: 1 addition & 1 deletion src/GameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct DifficultyInfo
u32 minRank;
u32 maxRank;
};
C_ASSERT(sizeof(DifficultyInfo) == 0xc);
ZUN_ASSERT_SIZE(DifficultyInfo, 0xc);

DIFFABLE_STATIC_ARRAY_ASSIGN(DifficultyInfo, 5, g_DifficultyInfoForReplay) = {
// rank, minRank, maxRank
Expand Down
2 changes: 1 addition & 1 deletion src/GameManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ struct GameManager
i32 minRank;
i32 subRank;
};
C_ASSERT(sizeof(GameManager) == 0x1a80);
ZUN_ASSERT_SIZE(GameManager, 0x1a80);
}; // namespace th06
10 changes: 5 additions & 5 deletions src/Gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct MsgRawHeader
i32 numInstrs;
MsgRawInstr *instrs[1];
};
C_ASSERT(sizeof(MsgRawHeader) == 0x8);
ZUN_ASSERT_SIZE(MsgRawHeader, 0x8);

struct GuiMsgVm
{
Expand All @@ -83,7 +83,7 @@ struct GuiMsgVm
u32 ignoreWaitCounter;
u8 dialogueSkippable;
};
C_ASSERT(sizeof(GuiMsgVm) == 0x6a8);
ZUN_ASSERT_SIZE(GuiMsgVm, 0x6a8);

struct GuiFormattedText
{
Expand All @@ -92,7 +92,7 @@ struct GuiFormattedText
i32 isShown;
ZunTimer timer;
};
C_ASSERT(sizeof(GuiFormattedText) == 0x20);
ZUN_ASSERT_SIZE(GuiFormattedText, 0x20);

struct GuiImpl
{
Expand All @@ -119,7 +119,7 @@ struct GuiImpl
GuiFormattedText fullPowerMode;
GuiFormattedText spellCardBonus;
};
C_ASSERT(sizeof(GuiImpl) == 0x2c44);
ZUN_ASSERT_SIZE(GuiImpl, 0x2c44);
struct GuiFlags
{
u32 flag0 : 2;
Expand Down Expand Up @@ -200,7 +200,7 @@ struct Gui
f32 bossHealthBar1;
f32 bossHealthBar2;
};
C_ASSERT(sizeof(Gui) == 0x2c);
ZUN_ASSERT_SIZE(Gui, 0x2c);

DIFFABLE_EXTERN(Gui, g_Gui);
}; // namespace th06
4 changes: 2 additions & 2 deletions src/ItemManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct Item
i8 unk_142;
i8 state;
};
C_ASSERT(sizeof(Item) == 0x144);
ZUN_ASSERT_SIZE(Item, 0x144);

struct ItemManager
{
Expand All @@ -47,7 +47,7 @@ struct ItemManager
i32 nextIndex;
u32 itemCount;
};
C_ASSERT(sizeof(ItemManager) == 0x2894c);
ZUN_ASSERT_SIZE(ItemManager, 0x2894c);

DIFFABLE_EXTERN(ItemManager, g_ItemManager);
}; // namespace th06
2 changes: 1 addition & 1 deletion src/MainMenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct MainMenu
i32 frameCountForRefreshRateCalc;
u32 lastFrameTime;
};
C_ASSERT(sizeof(MainMenu) == 0x10f34);
ZUN_ASSERT_SIZE(MainMenu, 0x10f34);

DIFFABLE_EXTERN(MainMenu, g_MainMenu);
}; // namespace th06
8 changes: 4 additions & 4 deletions src/MidiOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct MidiTimer
u32 timerId;
TIMECAPS timeCaps;
};
C_ASSERT(sizeof(MidiTimer) == 0x10);
ZUN_ASSERT_SIZE(MidiTimer, 0x10);

enum MidiOpcode
{
Expand Down Expand Up @@ -77,7 +77,7 @@ struct MidiTrack
u8 *startTrackDataMaybe;
u32 unk1c;
};
C_ASSERT(sizeof(MidiTrack) == 0x20);
ZUN_ASSERT_SIZE(MidiTrack, 0x20);

struct MidiDevice
{
Expand All @@ -92,7 +92,7 @@ struct MidiDevice
HMIDIOUT handle;
u32 deviceId;
};
C_ASSERT(sizeof(MidiDevice) == 0x8);
ZUN_ASSERT_SIZE(MidiDevice, 0x8);

struct MidiChannel
{
Expand Down Expand Up @@ -161,5 +161,5 @@ struct MidiOutput : MidiTimer
ULONGLONG unk2f0;
ULONGLONG unk2f8;
};
C_ASSERT(sizeof(MidiOutput) == 0x300);
ZUN_ASSERT_SIZE(MidiOutput, 0x300);
}; // namespace th06
4 changes: 2 additions & 2 deletions src/MusicRoom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct TrackDescriptor
char title[34];
char description[8][66];
};
C_ASSERT(sizeof(TrackDescriptor) == 0x272);
ZUN_ASSERT_SIZE(TrackDescriptor, 0x272);

// Force constructor to generate size optimized code when it's placed in the binary
#pragma optimize("s", on)
Expand Down Expand Up @@ -50,6 +50,6 @@ struct MusicRoom
AnmVm titleSprites[32];
AnmVm descriptionSprites[16];
};
C_ASSERT(sizeof(MusicRoom) == 0x3434);
ZUN_ASSERT_SIZE(MusicRoom, 0x3434);
#pragma optimize("", on)
}; // namespace th06
Loading

0 comments on commit 0b3fe22

Please sign in to comment.