Skip to content

Commit

Permalink
revert: revert
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Mar 2, 2024
1 parent 8573787 commit d1daa32
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 96 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
xmake repo -u
- run: |
xmake f -a x64 -m release -p windows -v -y
xmake f -a x64 -m release -p windows -y
- run: |
xmake -v -w -y
xmake -w -y
- uses: actions/upload-artifact@v4
with:
Expand Down
85 changes: 0 additions & 85 deletions src/change_this/Entry.cpp

This file was deleted.

9 changes: 0 additions & 9 deletions src/change_this/Entry.h

This file was deleted.

58 changes: 58 additions & 0 deletions src/change_this/RenameThis.cpp
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
33 changes: 33 additions & 0 deletions src/change_this/RenameThis.h
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

0 comments on commit d1daa32

Please sign in to comment.