mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-29 12:52:18 -05:00
Fixes buying songs crash on Switch (#2899)
This commit is contained in:
parent
30cc61abce
commit
4d02d89e03
@ -1,40 +1,46 @@
|
|||||||
#include "GameInteractor.h"
|
#include "GameInteractor.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
// MARK: - Gameplay
|
// MARK: - Gameplay
|
||||||
extern "C" void GameInteractor_ExecuteOnLoadGame(int32_t fileNum);
|
void GameInteractor_ExecuteOnLoadGame(int32_t fileNum);
|
||||||
extern "C" void GameInteractor_ExecuteOnExitGame(int32_t fileNum);
|
void GameInteractor_ExecuteOnExitGame(int32_t fileNum);
|
||||||
extern "C" void GameInteractor_ExecuteOnGameFrameUpdate();
|
void GameInteractor_ExecuteOnGameFrameUpdate();
|
||||||
extern "C" void GameInteractor_ExecuteOnItemReceiveHooks(GetItemEntry itemEntry);
|
void GameInteractor_ExecuteOnItemReceiveHooks(GetItemEntry itemEntry);
|
||||||
extern "C" void GameInteractor_ExecuteOnSaleEndHooks(GetItemEntry itemEntry);
|
void GameInteractor_ExecuteOnSaleEndHooks(GetItemEntry itemEntry);
|
||||||
extern "C" void GameInteractor_ExecuteOnTransitionEndHooks(int16_t sceneNum);
|
void GameInteractor_ExecuteOnTransitionEndHooks(int16_t sceneNum);
|
||||||
extern "C" void GameInteractor_ExecuteOnSceneInit(int16_t sceneNum);
|
void GameInteractor_ExecuteOnSceneInit(int16_t sceneNum);
|
||||||
extern "C" void GameInteractor_ExecuteOnSceneSpawnActors();
|
void GameInteractor_ExecuteOnSceneSpawnActors();
|
||||||
extern "C" void GameInteractor_ExecuteOnPlayerUpdate();
|
void GameInteractor_ExecuteOnPlayerUpdate();
|
||||||
extern "C" void GameInteractor_ExecuteOnOcarinaSongAction();
|
void GameInteractor_ExecuteOnOcarinaSongAction();
|
||||||
extern "C" void GameInteractor_ExecuteOnActorUpdate(void* actor);
|
void GameInteractor_ExecuteOnActorUpdate(void* actor);
|
||||||
extern "C" void GameInteractor_ExecuteOnPlayerBonk();
|
void GameInteractor_ExecuteOnPlayerBonk();
|
||||||
extern "C" void GameInteractor_ExecuteOnOcarinaSongAction();
|
void GameInteractor_ExecuteOnOcarinaSongAction();
|
||||||
|
|
||||||
// MARK: - Save Files
|
// MARK: - Save Files
|
||||||
extern "C" void GameInteractor_ExecuteOnSaveFile(int32_t fileNum);
|
void GameInteractor_ExecuteOnSaveFile(int32_t fileNum);
|
||||||
extern "C" void GameInteractor_ExecuteOnLoadFile(int32_t fileNum);
|
void GameInteractor_ExecuteOnLoadFile(int32_t fileNum);
|
||||||
extern "C" void GameInteractor_ExecuteOnDeleteFile(int32_t fileNum);
|
void GameInteractor_ExecuteOnDeleteFile(int32_t fileNum);
|
||||||
|
|
||||||
// MARK: - Dialog
|
// MARK: - Dialog
|
||||||
extern "C" void GameInteractor_ExecuteOnDialogMessage();
|
void GameInteractor_ExecuteOnDialogMessage();
|
||||||
extern "C" void GameInteractor_ExecuteOnPresentTitleCard();
|
void GameInteractor_ExecuteOnPresentTitleCard();
|
||||||
extern "C" void GameInteractor_ExecuteOnInterfaceUpdate();
|
void GameInteractor_ExecuteOnInterfaceUpdate();
|
||||||
extern "C" void GameInteractor_ExecuteOnKaleidoscopeUpdate(int16_t inDungeonScene);
|
void GameInteractor_ExecuteOnKaleidoscopeUpdate(int16_t inDungeonScene);
|
||||||
|
|
||||||
// MARK: - Main Menu
|
// MARK: - Main Menu
|
||||||
extern "C" void GameInteractor_ExecuteOnPresentFileSelect();
|
void GameInteractor_ExecuteOnPresentFileSelect();
|
||||||
extern "C" void GameInteractor_ExecuteOnUpdateFileSelectSelection(uint16_t optionIndex);
|
void GameInteractor_ExecuteOnUpdateFileSelectSelection(uint16_t optionIndex);
|
||||||
extern "C" void GameInteractor_ExecuteOnUpdateFileCopySelection(uint16_t optionIndex);
|
void GameInteractor_ExecuteOnUpdateFileCopySelection(uint16_t optionIndex);
|
||||||
extern "C" void GameInteractor_ExecuteOnUpdateFileCopyConfirmationSelection(uint16_t optionIndex);
|
void GameInteractor_ExecuteOnUpdateFileCopyConfirmationSelection(uint16_t optionIndex);
|
||||||
extern "C" void GameInteractor_ExecuteOnUpdateFileEraseSelection(uint16_t optionIndex);
|
void GameInteractor_ExecuteOnUpdateFileEraseSelection(uint16_t optionIndex);
|
||||||
extern "C" void GameInteractor_ExecuteOnUpdateFileEraseConfirmationSelection(uint16_t optionIndex);
|
void GameInteractor_ExecuteOnUpdateFileEraseConfirmationSelection(uint16_t optionIndex);
|
||||||
extern "C" void GameInteractor_ExecuteOnUpdateFileAudioSelection(uint8_t optionIndex);
|
void GameInteractor_ExecuteOnUpdateFileAudioSelection(uint8_t optionIndex);
|
||||||
extern "C" void GameInteractor_ExecuteOnUpdateFileTargetSelection(uint8_t optionIndex);
|
void GameInteractor_ExecuteOnUpdateFileTargetSelection(uint8_t optionIndex);
|
||||||
|
|
||||||
// MARK: - Game
|
// MARK: - Game
|
||||||
extern "C" void GameInteractor_ExecuteOnSetGameLanguage();
|
void GameInteractor_ExecuteOnSetGameLanguage();
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -688,9 +688,10 @@ std::unordered_map<uint32_t, uint32_t> ItemIDtoGetItemID{
|
|||||||
{ ITEM_WEIRD_EGG, GI_WEIRD_EGG }
|
{ ITEM_WEIRD_EGG, GI_WEIRD_EGG }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" uint32_t GetGIID(uint32_t itemID) {
|
extern "C" int32_t GetGIID(uint32_t itemID) {
|
||||||
if (ItemIDtoGetItemID.contains(itemID))
|
if (ItemIDtoGetItemID.contains(itemID)) {
|
||||||
return ItemIDtoGetItemID.at(itemID);
|
return ItemIDtoGetItemID.at(itemID);
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ void EntranceTracker_SetLastEntranceOverride(s16 entranceIndex);
|
|||||||
void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement);
|
void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement);
|
||||||
void SaveManager_ThreadPoolWait();
|
void SaveManager_ThreadPoolWait();
|
||||||
|
|
||||||
uint32_t GetGIID(uint32_t itemID);
|
int32_t GetGIID(uint32_t itemID);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||||
|
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||||
|
|
||||||
|
|
||||||
#define DO_ACTION_TEX_WIDTH() 48
|
#define DO_ACTION_TEX_WIDTH() 48
|
||||||
@ -1706,7 +1707,7 @@ u8 Return_Item_Entry(GetItemEntry itemEntry, ItemID returnItem ) {
|
|||||||
|
|
||||||
// Processes Item_Give returns
|
// Processes Item_Give returns
|
||||||
u8 Return_Item(u8 itemID, ModIndex modId, ItemID returnItem) {
|
u8 Return_Item(u8 itemID, ModIndex modId, ItemID returnItem) {
|
||||||
uint32_t get = GetGIID(itemID);
|
int32_t get = GetGIID(itemID);
|
||||||
if (get == -1) {
|
if (get == -1) {
|
||||||
modId = MOD_RANDOMIZER;
|
modId = MOD_RANDOMIZER;
|
||||||
get = itemID;
|
get = itemID;
|
||||||
@ -6158,8 +6159,13 @@ void Interface_Update(PlayState* play) {
|
|||||||
u16 tempSaleMod = gSaveContext.pendingSaleMod;
|
u16 tempSaleMod = gSaveContext.pendingSaleMod;
|
||||||
gSaveContext.pendingSale = ITEM_NONE;
|
gSaveContext.pendingSale = ITEM_NONE;
|
||||||
gSaveContext.pendingSaleMod = MOD_NONE;
|
gSaveContext.pendingSaleMod = MOD_NONE;
|
||||||
if (tempSaleMod == 0) {
|
if (tempSaleMod == MOD_NONE) {
|
||||||
tempSaleItem = GetGIID(tempSaleItem);
|
s16 giid = GetGIID(tempSaleItem);
|
||||||
|
if (giid == -1) {
|
||||||
|
tempSaleMod = MOD_RANDOMIZER;
|
||||||
|
} else {
|
||||||
|
tempSaleItem = giid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
GameInteractor_ExecuteOnSaleEndHooks(ItemTable_RetrieveEntry(tempSaleMod, tempSaleItem));
|
GameInteractor_ExecuteOnSaleEndHooks(ItemTable_RetrieveEntry(tempSaleMod, tempSaleItem));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user