Skip to content

Commit

Permalink
GUID Parse
Browse files Browse the repository at this point in the history
  • Loading branch information
chrystianfarias committed Feb 24, 2022
1 parent a6203b2 commit f55315a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
22 changes: 14 additions & 8 deletions GTAFmod/FMODAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,32 @@ void FMODAudio::LoadBank(FMOD::Studio::System* fmodSystem, char* absolutePath)

//Load events
FMOD::Studio::EventDescription* rpmEventDescription = NULL;
CheckError(fmodSystem->getEvent(m_Ini->m_sEngineExtEvent.c_str(), &rpmEventDescription), "Failed on get event");
FMOD::Studio::ID guidRpmEvent = { 0 };
CheckError(FMOD::Studio::parseID(m_Ini->m_sEngineExtEvent.c_str(), &guidRpmEvent), m_Ini->m_sEngineExtEvent.c_str());
CheckError(fmodSystem->getEventByID(&guidRpmEvent, &rpmEventDescription), "Failed on get rpm event");

FMOD::Studio::EventDescription* backFireEventDescription = NULL;
CheckError(fmodSystem->getEvent(m_Ini->m_sBackfireExtEvent.c_str(), &backFireEventDescription), "Failed on get event");
FMOD::Studio::ID guidBackFireEvent = { 0 };
CheckError(FMOD::Studio::parseID(m_Ini->m_sBackfireExtEvent.c_str(), &guidBackFireEvent), m_Ini->m_sBackfireExtEvent.c_str());
CheckError(fmodSystem->getEventByID(&guidBackFireEvent, &backFireEventDescription), "Failed on get backfire event");

FMOD::Studio::EventDescription* gearEventDescription = NULL;
CheckError(fmodSystem->getEvent(m_Ini->m_sGearExtEvent.c_str(), &gearEventDescription), "Failed on get event");
FMOD::Studio::ID guidGearEvent = { 0 };
CheckError(FMOD::Studio::parseID(m_Ini->m_sBackfireExtEvent.c_str(), &guidGearEvent), m_Ini->m_sBackfireExtEvent.c_str());
CheckError(fmodSystem->getEventByID(&guidGearEvent, &gearEventDescription), "Failed on get gear event");

//RPM Instance
CheckError(rpmEventDescription->createInstance(&m_RpmEventInstance), "Failed on create instance");
CheckError(rpmEventDescription->createInstance(&m_RpmEventInstance), "Failed on create rpm instance");

//Backfire Instance
CheckError(backFireEventDescription->createInstance(&m_BackFireEventInstance), "Failed on create instance");
CheckError(backFireEventDescription->createInstance(&m_BackFireEventInstance), "Failed on create backfire instance");

//Gear Change Instance
CheckError(gearEventDescription->createInstance(&m_GearEventInstance), "Failed on create instance");
CheckError(gearEventDescription->createInstance(&m_GearEventInstance), "Failed on create gear instance");

//Get parameters
CheckError(rpmEventDescription->getParameterDescriptionByName(m_Ini->m_sRPMParameter.c_str(), &m_RpmDesc), "Failed on get parameter");
CheckError(rpmEventDescription->getParameterDescriptionByName(m_Ini->m_sThrottleParameter.c_str(), &m_LoadDesc), "Failed on get parameter");
CheckError(rpmEventDescription->getParameterDescriptionByName(m_Ini->m_sRPMParameter.c_str(), &m_RpmDesc), "Failed on get rpms parameter");
CheckError(rpmEventDescription->getParameterDescriptionByName(m_Ini->m_sThrottleParameter.c_str(), &m_LoadDesc), "Failed on get toggle parameter");

//Set 3D space
m_RpmEventInstance->setReverbLevel(0, 2);
Expand Down
10 changes: 1 addition & 9 deletions GTAFmod/GTAFmod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class GTAFmod {
InitializeFmod();
InitializeDefaultBank();
SearchCustomBanks();
}
}
static void InitializeFmod()
{
void* extraDriverData = NULL;
Expand All @@ -62,21 +62,13 @@ class GTAFmod {
//Initialize Core System
FMOD::System* coreSystem = NULL;
FMODAudio::CheckError(fmodSystem->getCoreSystem(&coreSystem), "Failed on create FMOD CORE System");
FMODAudio::CheckError(coreSystem->setSoftwareFormat(0, FMOD_SPEAKERMODE_DEFAULT, 0), "Failed on set software format");
FMODAudio::CheckError(coreSystem->loadPlugin(PLUGIN_PATH((char*)"plugins\\fmod_distance_filter.dll"), 0, 0), "Failed on load plugin 'plugins\\fmod_distance_filter.dll'");

FMODAudio::CheckError(fmodSystem->initialize(1024, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_NORMAL, extraDriverData), "Failed to initialize");

FMOD_REVERB_PROPERTIES props = FMOD_PRESET_HANGAR;
FMODAudio::CheckError(coreSystem->setReverbProperties(0, &props), "Failed on set reverb");

//Load banks
FMOD::Studio::Bank* masterBank = NULL;
FMODAudio::CheckError(fmodSystem->loadBankFile(PLUGIN_PATH((char*)"banks\\common.dbank"), FMOD_STUDIO_LOAD_BANK_NORMAL, &masterBank), "Failed on load bank Master");

FMOD::Studio::Bank* stringsBank = NULL;
FMODAudio::CheckError(fmodSystem->loadBankFile(PLUGIN_PATH((char*)"banks\\common.strings.dbank"), FMOD_STUDIO_LOAD_BANK_NORMAL, &stringsBank), "Failed on load bank Master String");

//Projects using FMOD Studio must include an in-app credit line and the FMOD logo.
if (iniConfig->m_bUseLogo)
{
Expand Down
4 changes: 2 additions & 2 deletions GTAFmod/GTAFmod.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTASA zDebug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
4 changes: 2 additions & 2 deletions GTAFmodDashboard/GTAFmodDashboard.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTASA zDebug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down

0 comments on commit f55315a

Please sign in to comment.