-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements initial WaveClass extension.
- Loading branch information
Showing
8 changed files
with
640 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
/******************************************************************************* | ||
/* O P E N S O U R C E -- V I N I F E R A ** | ||
/******************************************************************************* | ||
* | ||
* @project Vinifera | ||
* | ||
* @file WAVEEXT.CPP | ||
* | ||
* @author CCHyper | ||
* | ||
* @brief Extended WaveClass class. | ||
* | ||
* @license Vinifera 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, either version | ||
* 3 of the License, or (at your option) any later version. | ||
* | ||
* Vinifera 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 for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
******************************************************************************/ | ||
#include "waveext.h" | ||
#include "wave.h" | ||
#include "wwcrc.h" | ||
#include "asserthandler.h" | ||
#include "debughandler.h" | ||
|
||
|
||
/** | ||
* Provides the map for all WaveClass extension instances. | ||
*/ | ||
ExtensionMap<WaveClass, WaveClassExtension> WaveClassExtensions; | ||
|
||
|
||
/** | ||
* Class constructor. | ||
* | ||
* @author: CCHyper | ||
*/ | ||
WaveClassExtension::WaveClassExtension(WaveClass *this_ptr) : | ||
Extension(this_ptr) | ||
{ | ||
ASSERT(ThisPtr != nullptr); | ||
//DEV_DEBUG_TRACE("WaveClassExtension constructor - 0x%08X\n", (uintptr_t)(ThisPtr)); | ||
//DEV_DEBUG_WARNING("WaveClassExtension constructor - 0x%08X\n", (uintptr_t)(ThisPtr)); | ||
|
||
IsInitialized = true; | ||
} | ||
|
||
|
||
/** | ||
* Class no-init constructor. | ||
* | ||
* @author: CCHyper | ||
*/ | ||
WaveClassExtension::WaveClassExtension(const NoInitClass &noinit) : | ||
Extension(noinit) | ||
{ | ||
IsInitialized = false; | ||
} | ||
|
||
|
||
/** | ||
* Class deconstructor. | ||
* | ||
* @author: CCHyper | ||
*/ | ||
WaveClassExtension::~WaveClassExtension() | ||
{ | ||
//DEV_DEBUG_TRACE("WaveClassExtension deconstructor - 0x%08X\n", (uintptr_t)(ThisPtr)); | ||
//DEV_DEBUG_WARNING("WaveClassExtension deconstructor - 0x%08X\n", (uintptr_t)(ThisPtr)); | ||
|
||
IsInitialized = false; | ||
} | ||
|
||
|
||
/** | ||
* Initializes an object from the stream where it was saved previously. | ||
* | ||
* @author: CCHyper | ||
*/ | ||
HRESULT WaveClassExtension::Load(IStream *pStm) | ||
{ | ||
ASSERT(ThisPtr != nullptr); | ||
//DEV_DEBUG_TRACE("WaveClassExtension::Load - 0x%08X\n", (uintptr_t)(ThisPtr)); | ||
|
||
HRESULT hr = Extension::Load(pStm); | ||
if (FAILED(hr)) { | ||
return E_FAIL; | ||
} | ||
|
||
new (this) WaveClassExtension(NoInitClass()); | ||
|
||
return hr; | ||
} | ||
|
||
|
||
/** | ||
* Saves an object to the specified stream. | ||
* | ||
* @author: CCHyper | ||
*/ | ||
HRESULT WaveClassExtension::Save(IStream *pStm, BOOL fClearDirty) | ||
{ | ||
ASSERT(ThisPtr != nullptr); | ||
//DEV_DEBUG_TRACE("WaveClassExtension::Save - 0x%08X\n", (uintptr_t)(ThisPtr)); | ||
|
||
HRESULT hr = Extension::Save(pStm, fClearDirty); | ||
if (FAILED(hr)) { | ||
return hr; | ||
} | ||
|
||
return hr; | ||
} | ||
|
||
|
||
/** | ||
* Return the raw size of class data for save/load purposes. | ||
* | ||
* @author: CCHyper | ||
*/ | ||
int WaveClassExtension::Size_Of() const | ||
{ | ||
ASSERT(ThisPtr != nullptr); | ||
//DEV_DEBUG_TRACE("WaveClassExtension::Size_Of - 0x%08X\n", (uintptr_t)(ThisPtr)); | ||
|
||
return sizeof(*this); | ||
} | ||
|
||
|
||
/** | ||
* Removes the specified target from any targeting and reference trackers. | ||
* | ||
* @author: CCHyper | ||
*/ | ||
void WaveClassExtension::Detach(TARGET target, bool all) | ||
{ | ||
ASSERT(ThisPtr != nullptr); | ||
//DEV_DEBUG_TRACE("WaveClassExtension::Detach - 0x%08X\n", (uintptr_t)(ThisPtr)); | ||
} | ||
|
||
|
||
/** | ||
* Compute a unique crc value for this instance. | ||
* | ||
* @author: CCHyper | ||
*/ | ||
void WaveClassExtension::Compute_CRC(WWCRCEngine &crc) const | ||
{ | ||
ASSERT(ThisPtr != nullptr); | ||
//DEV_DEBUG_TRACE("WaveClassExtension::Compute_CRC - 0x%08X\n", (uintptr_t)(ThisPtr)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/******************************************************************************* | ||
/* O P E N S O U R C E -- V I N I F E R A ** | ||
/******************************************************************************* | ||
* | ||
* @project Vinifera | ||
* | ||
* @file WAVEEXT.H | ||
* | ||
* @author CCHyper | ||
* | ||
* @brief Extended WaveClass class. | ||
* | ||
* @license Vinifera 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, either version | ||
* 3 of the License, or (at your option) any later version. | ||
* | ||
* Vinifera 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 for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
******************************************************************************/ | ||
#pragma once | ||
|
||
#include "extension.h" | ||
#include "container.h" | ||
#include "wave.h" | ||
|
||
|
||
class WaveClassExtension final : public Extension<WaveClass> | ||
{ | ||
public: | ||
WaveClassExtension(WaveClass *this_ptr); | ||
WaveClassExtension(const NoInitClass &noinit); | ||
~WaveClassExtension(); | ||
|
||
virtual HRESULT Load(IStream *pStm) override; | ||
virtual HRESULT Save(IStream *pStm, BOOL fClearDirty) override; | ||
virtual int Size_Of() const override; | ||
|
||
virtual void Detach(TARGET target, bool all = true) override; | ||
virtual void Compute_CRC(WWCRCEngine &crc) const override; | ||
|
||
public: | ||
}; | ||
|
||
|
||
extern ExtensionMap<WaveClass, WaveClassExtension> WaveClassExtensions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/******************************************************************************* | ||
/* O P E N S O U R C E -- V I N I F E R A ** | ||
/******************************************************************************* | ||
* | ||
* @project Vinifera | ||
* | ||
* @file WAVEEXT_HOOKS.CPP | ||
* | ||
* @author CCHyper | ||
* | ||
* @brief Contains the hooks for the extended WaveClass. | ||
* | ||
* @license Vinifera 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, either version | ||
* 3 of the License, or (at your option) any later version. | ||
* | ||
* Vinifera 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 for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
******************************************************************************/ | ||
#include "waveext_hooks.h" | ||
#include "waveext_init.h" | ||
#include "wave.h" | ||
#include "fatal.h" | ||
#include "asserthandler.h" | ||
#include "debughandler.h" | ||
|
||
#include "hooker.h" | ||
#include "hooker_macros.h" | ||
|
||
|
||
/** | ||
* Main function for patching the hooks. | ||
*/ | ||
void WaveClassExtension_Hooks() | ||
{ | ||
/** | ||
* Initialises the extended class. | ||
*/ | ||
WaveClassExtension_Init(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/******************************************************************************* | ||
/* O P E N S O U R C E -- V I N I F E R A ** | ||
/******************************************************************************* | ||
* | ||
* @project Vinifera | ||
* | ||
* @file WAVEEXT_HOOKS.H | ||
* | ||
* @author CCHyper | ||
* | ||
* @brief Contains the hooks for the extended WaveClass. | ||
* | ||
* @license Vinifera 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, either version | ||
* 3 of the License, or (at your option) any later version. | ||
* | ||
* Vinifera 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 for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
******************************************************************************/ | ||
#pragma once | ||
|
||
|
||
void WaveClassExtension_Hooks(); |
Oops, something went wrong.