Skip to content

Commit

Permalink
Merge pull request #233 from roblabla/gamemanager-deletedcallback
Browse files Browse the repository at this point in the history
Implement GameManager::DeletedCallback
  • Loading branch information
roblabla committed Sep 3, 2024
2 parents 878654c + 4174b47 commit e3f842d
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/implemented.csv
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ GameWindow::Present
GameWindow::Render
GameManager::GameManager
GameManager::AddedCallback
GameManager::DeletedCallback
GameManager::RegisterChain
GameManager::CutChain
GameManager::HasReachedMaxClears
Expand Down
9 changes: 8 additions & 1 deletion config/stubbed.csv
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
AnmManager::TakeScreenshotIfRequested
AnmManager::DrawStringFormat
AnmManager::DrawStringFormat2
EclManager::Unload
EffectManager::CutChain
EffectManager::DeletedCallback
EffectManager::EffectUpdateCallback1
EffectManager::EffectUpdateCallback2
EffectManager::EffectUpdateCallback3
EffectManager::EffectUpdateCallback4
EffectManager::EffectUpdateCallback5
EffectManager::EffectUpdateCallback6
Stage::CutChain
Stage::DeletedCallback
StageMenu::OnUpdateGameMenu
StageMenu::OnUpdateRetryMenu
Expand Down Expand Up @@ -37,13 +40,13 @@ Supervisor::DeletedCallback
Supervisor::StopAudio
Supervisor::SetupMidiPlayback
Supervisor::ReadMidiFile
GameManager::DeletedCallback
Ending::RegisterChain
MusicRoom::RegisterChain
ResultScreen::RegisterChain
ResultScreen::ReleaseScoreDat
ScreenEffect::RegisterChain
MainMenu::SelectRelated
Gui::CutChain
Gui::DeletedCallback
Gui::CalculateStageScore
Gui::HasCurrentMsgIdx
Expand All @@ -56,6 +59,7 @@ Gui::ShowSpellcardBonus
Gui::Vm6SetInterruptTo1
GuiImpl::RunMsg
GuiImpl::DrawDialogue
EnemyManager::CutChain
EnemyManager::DeletedCallback
Enemy::SetVar
Enemy::MathAdd
Expand All @@ -67,6 +71,7 @@ Enemy::MathAtan2
Enemy::MovePosTime
Enemy::MoveDirTime
Enemy::MoveTime
BulletManager::CutChain
BulletManager::DespawnBullets
BulletManager::DeletedCallback
BulletManager::InitializeToZero
Expand All @@ -77,10 +82,12 @@ ItemManager::SpawnItem
ItemManager::OnUpdate
ItemManager::OnDraw
ReplayManager::RegisterChain
ReplayManager::StopRecording
SaveReplay
ValidateReplayData
DrawSquare
Controller::GetControllerState
Player::CutChain
Player::DrawBulletExplosions
Player::CalcDamageToEnemy
Player::DeletedCallback
Expand Down
1 change: 1 addition & 0 deletions src/BulletManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ C_ASSERT(sizeof(Laser) == 0x270);
struct BulletManager
{
static ZunResult RegisterChain(char *bulletAnmPath);
static void CutChain();
static ZunResult AddedCallback(BulletManager *mgr);
static ZunResult DeletedCallback(BulletManager *mgr);
static ChainCallbackResult OnUpdate(BulletManager *mgr);
Expand Down
1 change: 1 addition & 0 deletions src/EclManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ enum EclRawInstrOpcode
struct EclManager
{
ZunResult Load(char *ecl);
void Unload();
ZunResult RunEcl(Enemy *enemy);
ZunResult CallEclSub(EnemyEclContext *enemyEcl, i16 subId);

Expand Down
1 change: 1 addition & 0 deletions src/EffectManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct EffectManager
Effect dummyEffect;

static ZunResult RegisterChain();
static void CutChain();
static ChainCallbackResult OnUpdate(EffectManager *mgr);
static ZunResult AddedCallback(EffectManager *mgr);
static ZunResult DeletedCallback(EffectManager *mgr);
Expand Down
1 change: 1 addition & 0 deletions src/EnemyManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct EnemyManager
{
void Initialize();
static ZunResult RegisterChain(char *stgEnm1, char *stgEnm2);
static void CutChain();
static ChainCallbackResult OnUpdate(EnemyManager *enemyManager);
static ChainCallbackResult OnDraw(EnemyManager *enemyManager);
static ZunResult AddedCallback(EnemyManager *enemyManager);
Expand Down
24 changes: 24 additions & 0 deletions src/GameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,30 @@ ZunResult GameManager::AddedCallback(GameManager *mgr)
}
#pragma optimize("", on)

#pragma optimize("s", on)
ZunResult GameManager::DeletedCallback(GameManager *mgr)
{
i32 padding1, padding2, padding3;

g_Supervisor.d3dDevice->ResourceManagerDiscardBytes(0);
if (!g_GameManager.demoMode)
{
g_Supervisor.StopAudio();
}
Stage::CutChain();
BulletManager::CutChain();
Player::CutChain();
EnemyManager::CutChain();
g_EclManager.Unload();
EffectManager::CutChain();
Gui::CutChain();
ReplayManager::StopRecording();
mgr->isInMenu = 0;
g_AsciiManager.InitializeVms();
return ZUN_SUCCESS;
}
#pragma optimize("", on)

#pragma optimize("s", on)
i32 GameManager::HasReachedMaxClears(i32 character, i32 shottype)
{
Expand Down
1 change: 1 addition & 0 deletions src/Gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct GuiFlags
struct Gui
{
static ZunResult RegisterChain();
static void CutChain();
static ZunResult AddedCallback(Gui *);
static ZunResult DeletedCallback(Gui *);
static ChainCallbackResult OnUpdate(Gui *);
Expand Down
1 change: 1 addition & 0 deletions src/Player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ struct Player
Player();

static ZunResult RegisterChain(u8 unk);
static void CutChain();
static ChainCallbackResult OnUpdate(Player *p);
static ChainCallbackResult OnDrawHighPrio(Player *p);
static ChainCallbackResult OnDrawLowPrio(Player *p);
Expand Down
1 change: 1 addition & 0 deletions src/ReplayManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
struct ReplayManager
{
static ZunResult RegisterChain(i32 isDemo, char *replayFile);
static void StopRecording();
};
1 change: 1 addition & 0 deletions src/Stage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ enum StageOpcode
struct Stage
{
static ZunResult RegisterChain(u32 stage);
static void CutChain();
static ChainCallbackResult OnUpdate(Stage *stage);
static ChainCallbackResult OnDrawHighPrio(Stage *stage);
static ChainCallbackResult OnDrawLowPrio(Stage *stage);
Expand Down

0 comments on commit e3f842d

Please sign in to comment.