-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
93 additions
and
96 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,58 @@ | ||
#include "RenameThis.h" | ||
|
||
#include <ll/api/plugin/NativePlugin.h> | ||
#include <memory> | ||
|
||
namespace rename_this { | ||
|
||
RenameThis::RenameThis() = default; | ||
|
||
RenameThis& RenameThis::getInstance() { | ||
static RenameThis instance; | ||
return instance; | ||
} | ||
|
||
ll::plugin::NativePlugin& RenameThis::getSelf() const { return *mSelf; } | ||
|
||
bool RenameThis::load(ll::plugin::NativePlugin& self) { | ||
mSelf = std::addressof(self); | ||
getSelf().getLogger().info("loading..."); | ||
|
||
// Code for loading the plugin goes here. | ||
|
||
return true; | ||
} | ||
|
||
bool RenameThis::enable() { | ||
getSelf().getLogger().info("enabling..."); | ||
|
||
// Code for enabling the plugin goes here. | ||
|
||
return true; | ||
} | ||
|
||
bool RenameThis::disable() { | ||
getSelf().getLogger().info("disabling..."); | ||
|
||
// Code for disabling the plugin goes here. | ||
|
||
return true; | ||
} | ||
|
||
extern "C" { | ||
_declspec(dllexport) bool ll_plugin_load(ll::plugin::NativePlugin& self) { | ||
return RenameThis::getInstance().load(self); | ||
} | ||
|
||
_declspec(dllexport) bool ll_plugin_enable(ll::plugin::NativePlugin&) { return RenameThis::getInstance().enable(); } | ||
|
||
_declspec(dllexport) bool ll_plugin_disable(ll::plugin::NativePlugin&) { return RenameThis::getInstance().disable(); } | ||
|
||
/// @warning Unloading the plugin may cause a crash if the plugin has not released all of its | ||
/// resources. If you are unsure, keep this function commented out. | ||
// _declspec(dllexport) bool ll_plugin_unload(ll::plugin::NativePlugin&) { | ||
// return RenameThis::getInstance().unload(); | ||
// } | ||
} | ||
|
||
} // namespace rename_this |
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,33 @@ | ||
#pragma once | ||
|
||
#include <ll/api/plugin/NativePlugin.h> | ||
|
||
namespace rename_this { | ||
|
||
class RenameThis { | ||
RenameThis(); | ||
|
||
public: | ||
RenameThis(RenameThis&&) = delete; | ||
RenameThis(const RenameThis&) = delete; | ||
RenameThis& operator=(RenameThis&&) = delete; | ||
RenameThis& operator=(const RenameThis&) = delete; | ||
|
||
static RenameThis& getInstance(); | ||
|
||
[[nodiscard]] ll::plugin::NativePlugin& getSelf() const; | ||
|
||
/// @return True if the plugin is loaded successfully. | ||
bool load(ll::plugin::NativePlugin&); | ||
|
||
/// @return True if the plugin is enabled successfully. | ||
bool enable(); | ||
|
||
/// @return True if the plugin is disabled successfully. | ||
bool disable(); | ||
|
||
private: | ||
ll::plugin::NativePlugin* mSelf{}; | ||
}; | ||
|
||
} // namespace rename_this |