Dolphin, the GameCube and Wii emulator - Forums

Full Version: AFC Looping Checkbox for DSP Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9
Too much, but I didn't break much except for those errors, I'm also getting this error..

Code:
Error    8    error C2660: 'GConfig::Load' : function does not take 0 arguments    d:\My Documents\Emulator SVN\Dolphin\Source\Plugins\Plugin_DSP_HLE\Src\Config.cpp    58

The above error seems to occur because of the following bolded code:

Config.cpp

Quote:// Copyright © 2003 Dolphin Project.

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.

// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/

// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#include "Globals.h"
#include "Common.h"
#include "IniFile.h"
#include "Config.h"
#include "AudioCommon.h"
#include "FileUtil.h"

CConfig g_Config;
GConfig g_GConfig;

CConfig::CConfig()
{
Load();
}

void CConfig::Load()
{
// first load defaults
IniFile file;
file.Load((std:Confusedtring(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
file.Get("Config", "EnableHLEAudio", &m_EnableHLEAudio, true); // Sound Settings
file.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack
file.Get("Config", "EnableAFCAudioLoopingHack", &m_EnableAFCLoopingHack, false); // AFC Looping Hack
ac_Config.Load(file);
}

void CConfig::Save()
{
IniFile file;
file.Load((std:Confusedtring(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
file.Set("Config", "EnableHLEAudio", m_EnableHLEAudio); // Sound Settings
file.Set("Config", "EnableRE0AudioFix", m_EnableRE0Fix); // RE0 Hack
file.Set("Config", "EnableAFCAudioLoopingHack", m_EnableAFCLoopingHack); // AFC Looping Hack
ac_Config.Set(file);

file.Save((std:Confusedtring(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
}

GConfig::GConfig()
{
Load();
}


void GConfig::Load(const char *game_ini)
{
if (game_ini && strlen(game_ini))
{
IniFile iniFile;
iniFile.Load((std:Confusedtring(File::GetUserPath(D_CONFIG_IDX)) + "game_ini.ini").c_str());
iniFile.Get("HLEaudio", "UseRE0Fix", &m_EnableRE0Fix, false);
iniFile.Get("HLEaudio", "EnableAFCAudioLoopingHack", &m_EnableAFCLoopingHack, false);
ac_GConfig.Load(iniFile);
}
}

void GConfig::Save(const char *game_ini)
{
if (game_ini && strlen(game_ini))
{
IniFile iniFile;
iniFile.Load((std:Confusedtring(File::GetUserPath(D_CONFIG_IDX)) + "game_ini.ini").c_str());
iniFile.Set("Config", "EnableRE0AudioFix", m_EnableRE0Fix); // RE0 Hack
iniFile.Set("Config", "EnableAFCAudioLoopingHack", m_EnableAFCLoopingHack); // AFC Looping Hack
ac_GConfig.Set(iniFile);

iniFile.Save((std:Confusedtring(File::GetUserPath(D_CONFIG_IDX)) + "game_ini.ini").c_str());
}
}

The other errors seem to be because of the bolded parenthesis not being at the end of the following code..

LuisR14's version of Config.h:

Quote:struct GConfig : public CConfig
{
GConfig();

void Load(const char *game_ini);
void Save(){}; // dull function :p
};

extern CConfig g_Config;
extern GConfig g_GConfig;

My version of Config.h:

Quote:struct GConfig : public CConfig
{
GConfig();

bool m_EnableRE0Fix;
bool m_EnableAFCLoopingHack;

void Load(const char *game_ini);
void Save(const char *game_ini); // dull function :p
};

extern CConfig g_Config;
extern GConfig g_GConfig;[/code]

Note that the second pair of parenthesis are not after my version of "void save", this throws out an unresolved externals error..
void Load(const char *game_ini);
You need to pass in argument that is a some ini file name.
I'm a total newbie at coding, I've been referencing and reading as I'm going along and plan on doing some thorough reading of C++ tutorials later on. If it's not too much to ask, how would I accomplish what you are referring to? This way if I run into the same error later on I'll know how to solve it myself. Smile

Even if I mess this up and it doesn't work the way I had hoped if at all, I can learn how to do it right the next time around.
First learn programming Tongue
I am learning, just haven't learned that much yet..
Quote:Index: Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp
===================================================================
--- Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp (revision 5011)
+++ Source/Plugins/Plugin_DSP_HLE/Src/Config.cpp (working copy)
@@ -23,6 +23,7 @@
#include "FileUtil.h"

CConfig g_Config;
+GConfig g_GConfig;

CConfig::CConfig()
{
@@ -36,6 +37,7 @@
file.Load((std:Confusedtring(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
file.Get("Config", "EnableHLEAudio", &m_EnableHLEAudio, true); // Sound Settings
file.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack
+ file.Get("Config", "EnableAFCAudioLoopingHack", &m_EnableAFCLoopingHack, false); // AFC Looping Hack
ac_Config.Load(file);
}

@@ -45,24 +47,23 @@
file.Load((std:Confusedtring(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
file.Set("Config", "EnableHLEAudio", m_EnableHLEAudio); // Sound Settings
file.Set("Config", "EnableRE0AudioFix", m_EnableRE0Fix); // RE0 Hack
+ file.Set("Config", "EnableAFCAudioLoopingHack", m_EnableAFCLoopingHack); // AFC Looping Hack
ac_Config.Set(file);

file.Save((std:Confusedtring(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
}

-void CConfig::GameIniLoad(const char *game_ini)
+GConfig::GConfig()
{
-// This game config will affect global system config
-// Need a better way to seperate system config from game config
-//
-/*
+}
+
+void GConfig::Load(const char *game_ini)
+{
if (game_ini && strlen(game_ini))
{
IniFile iniFile;
iniFile.Load(game_ini);
- //iniFile.Get("HLEaudio", "UseRE0Fix", &m_EnableRE0Fix, 0);
- //iniFile.Get("HLEaudio", "UseLoopFix", &m_EnableLoopFix, 0);
+ iniFile.Get("HLEaudio", "UseRE0Fix", &m_EnableRE0Fix, false);
+ iniFile.Get("HLEaudio", "EnableAFCAudioLoopingHack", &m_EnableAFCLoopingHack, false);
}
-*/
}
-

I have no error
Woot!

I figured it out on my own with a bit of looking at the files. Big Grin

LuisR14

so how's your patch now? :p (you don't need Save() btw, since ISOProperties does it already :p + i didn't fill in GConfig() since you don't have any ini when the plugin is loaded)
btw here's a less confusing way for the IF in UCode_Zelda_Voice.cpp :p
Code:
        if (PB.RepeatMode == 0)
        {
            PB.KeyOff = 1;
            PB.RemLength = 0;
            PB.CurAddr = PB.StartAddr + PB.RestartPos + PB.Length;
            
            while (sampleCount < _RealSize)
                _Buffer[sampleCount++] = 0;
            return;
        }
        else
        {
            // AFC Looping HACK: Fixes intro music in Zelda Twilight Princess and Pikmin audio.
            // AFC looping doesn't work correctly, music will abruptly cease in Zelda Twilight Princess after playing for a short while,
            // causes sound oddities with Zelda WindWaker and Super Mario Galaxy.
            //
            // AFC looping can now be enabled/disabled from the DSP configuration,
            // making the former method of enabling/disabling the AFC looping hack obsolete until a proper fix can be implemented.
            if (g_Config.m_EnableAFCLoopingHack || g_GConfig.m_EnableAFCLoopingHack)
            {
                // The loop start pos is incorrect, so samples will loop a bit wrong. However, at least
                // this fixes the intro music in ZTP, Pikmin2.
                // PB.RestartPos = PB.LoopStartPos;
                PB.RemLength = PB.Length; // - PB.RestartPos;
                PB.CurAddr = PB.StartAddr; //+ (PB.LoopStartPos >> 4) * PB.Format + ;
                // Hmm, this shouldn't be reversed .. or should it? Is it different between versions of the ucode?
                PB.YN1 = PB.LoopYN2;
                PB.YN2 = PB.LoopYN1;
            }
                
        }
i don' t know if it use the same audio code, but you think that this loop patch could solve the problem of stopping music in Mario Kart Double dash? (issue 1998)?
http://code.google.com/p/dolphin-emu/issues/detail?id=1998
I think MKBig GrinD does use the Zelda UCode and ACF formats ;p
Pages: 1 2 3 4 5 6 7 8 9