options_menu: implemented Voice Language (and some misc. clean-up)

This commit is contained in:
Hyper 2024-11-21 21:01:04 +00:00
parent ee4bb3d63c
commit e545a95141
7 changed files with 60 additions and 20 deletions

View file

@ -36,6 +36,7 @@
#include "SWA/CSD/CsdProject.h"
#include "SWA/CSD/CsdTexListMirage.h"
#include "SWA/CSD/GameObjectCSD.h"
#include "SWA/HUD/Loading/Loading.h"
#include "SWA/HUD/Pause/HudPause.h"
#include "SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h"
#include "SWA/Player/Character/EvilSonic/EvilSonic.h"

View file

@ -0,0 +1,30 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
enum ELoadingDisplayType
{
eLoadingDisplayType_MilesElectric,
eLoadingDisplayType_None,
eLoadingDisplayType_WerehogMovie,
eLoadingDisplayType_MilesElectricContext,
eLoadingDisplayType_Arrows,
eLoadingDisplayType_NowLoading,
eLoadingDisplayType_EventGallery,
eLoadingDisplayType_ChangeTimeOfDay,
eLoadingDisplayType_Blank
};
class CLoading
{
public:
SWA_INSERT_PADDING(0x128);
bool m_IsVisible;
SWA_INSERT_PADDING(0x0C);
be<ELoadingDisplayType> m_LoadingDisplayType;
SWA_INSERT_PADDING(0x65);
bool m_IsNightToDay;
};
}

View file

@ -5,6 +5,12 @@
namespace SWA
{
enum EVoiceLanguage : uint32_t
{
eVoiceLanguage_English,
eVoiceLanguage_Japanese
};
class CApplicationDocument // : public Hedgehog::Base::CSynchronizedObject
{
public:
@ -22,7 +28,9 @@ namespace SWA
xpointer<void> m_pVftable;
xpointer<CMember> m_pMember;
SWA_INSERT_PADDING(0x14);
SWA_INSERT_PADDING(0x04);
be<EVoiceLanguage> m_VoiceLanguage;
SWA_INSERT_PADDING(0x0C);
be<uint32_t> m_Region;
};
}

View file

@ -1,6 +1,6 @@
#include <app.h>
#include <kernel/function.h>
#include <ui/window.h>
#include <app.h>
#include <patches/audio_patches.h>
double g_deltaTime;

View file

@ -2,6 +2,7 @@
#include <cfg/config.h>
#include <kernel/function.h>
#include <patches/audio_patches.h>
#include <api/SWA.h>
be<float>* GetVolume(bool isMusic = true)
{
@ -26,5 +27,15 @@ void AudioPatches::Update(float deltaTime)
*pEffectsVolume = Config::EffectsVolume;
}
PPC_FUNC_IMPL(__imp__sub_824EB9B0);
PPC_FUNC(sub_824EB9B0)
{
auto pApplicationDocument = (SWA::CApplicationDocument*)g_memory.Translate(ctx.r4.u32);
pApplicationDocument->m_VoiceLanguage = (SWA::EVoiceLanguage)Config::VoiceLanguage.Value;
__imp__sub_824EB9B0(ctx, base);
}
// Stub volume setter.
GUEST_FUNCTION_STUB(sub_82E58728);

View file

@ -1,5 +1,6 @@
#include <cpu/guest_code.h>
#include <cfg/config.h>
#include <api/SWA.h>
const char* m_pStageID;
@ -12,30 +13,19 @@ void GetStageIDMidAsmHook(PPCRegister& r5)
PPC_FUNC_IMPL(__imp__sub_824DCF38);
PPC_FUNC(sub_824DCF38)
{
// TODO: use the actual PS3 loading screen.
// TODO: use the actual PS3 loading screen ("n_2_d").
if (Config::TimeOfDayTransition == ETimeOfDayTransition::PlayStation)
{
/*
0 - Tails Electric NOW LOADING
1 - No Transition
2 - Werehog Transition
3 - Tails Electric NOW LOADING w/ Info (requires context)
4 - Arrows In/Out
5 - NOW LOADING
6 - Event Gallery
7 - NOW LOADING
8 - Black Screen
*/
if (ctx.r4.u32 == 2)
ctx.r4.u32 = 4;
if (ctx.r4.u32 == SWA::eLoadingDisplayType_WerehogMovie)
ctx.r4.u32 = SWA::eLoadingDisplayType_Arrows;
}
if (m_pStageID)
{
/* Fix restarting Eggmanland as the Werehog
erroneously using the Event Gallery transition. */
if (ctx.r4.u32 == 6 && !strcmp(m_pStageID, "Act_EggmanLand"))
ctx.r4.u32 = 5;
if (ctx.r4.u32 == SWA::eLoadingDisplayType_EventGallery && !strcmp(m_pStageID, "Act_EggmanLand"))
ctx.r4.u32 = SWA::eLoadingDisplayType_NowLoading;
}
__imp__sub_824DCF38(ctx, base);

View file

@ -860,14 +860,14 @@ static void DrawConfigOptions()
case 1: // INPUT
DrawConfigOption(rowCount++, yOffset, &Config::InvertCameraX, true);
DrawConfigOption(rowCount++, yOffset, &Config::InvertCameraY, true);
DrawConfigOption(rowCount++, yOffset, &Config::XButtonHoming, OptionsMenu::s_pauseMenuType == SWA::eMenuType_WorldMap, cmnReason); // TODO: make this editable in stages?
DrawConfigOption(rowCount++, yOffset, &Config::XButtonHoming, OptionsMenu::s_pauseMenuType == SWA::eMenuType_WorldMap, cmnReason);
DrawConfigOption(rowCount++, yOffset, &Config::AllowCancellingUnleash, true);
DrawConfigOption(rowCount++, yOffset, &Config::AllowBackgroundInput, true);
break;
case 2: // AUDIO
DrawConfigOption(rowCount++, yOffset, &Config::MusicVolume, true);
DrawConfigOption(rowCount++, yOffset, &Config::EffectsVolume, true);
DrawConfigOption(rowCount++, yOffset, &Config::VoiceLanguage, true);
DrawConfigOption(rowCount++, yOffset, &Config::VoiceLanguage, OptionsMenu::s_pauseMenuType == SWA::eMenuType_WorldMap, cmnReason);
DrawConfigOption(rowCount++, yOffset, &Config::Subtitles, true);
DrawConfigOption(rowCount++, yOffset, &Config::BattleTheme, true);
break;