-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expanded PaintTool paint size from 16 to 64
- Loading branch information
1 parent
c0cec1f
commit d4dd500
Showing
8 changed files
with
107 additions
and
3 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,15 @@ | ||
#pragma once | ||
|
||
#include "SmSdk/Util/StaticVariable.hpp" | ||
|
||
class StaticValues | ||
{ | ||
public: | ||
using PaintToolPaintLimiterType = StaticVariable<std::uint32_t, 0x3F060D>; | ||
using PaintToolEraseLimiterType = StaticVariable<std::uint32_t, 0x3F0D9B>; | ||
|
||
//A limiter for paint tool paint function | ||
static PaintToolPaintLimiterType sm_paintToolPaintLimiter; | ||
//A limiter for paint tool erase function | ||
static PaintToolEraseLimiterType sm_paintToolEraseLimiter; | ||
}; |
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,35 @@ | ||
#pragma once | ||
|
||
#define WIN32_LEAN_AND_MEAN | ||
#define NOMINMAX | ||
#include <Windows.h> | ||
|
||
#include <cstddef> | ||
#include <cstdint> | ||
#include <memory> | ||
|
||
namespace Memory | ||
{ | ||
template<typename T> | ||
inline static T& ReadRef(std::uintptr_t offset) | ||
{ | ||
return *reinterpret_cast<T*>(std::uintptr_t(GetModuleHandle(NULL)) + offset); | ||
} | ||
|
||
template<typename T> | ||
inline static T* ReadPtr(std::uintptr_t offset) | ||
{ | ||
return reinterpret_cast<T*>(std::uintptr_t(GetModuleHandle(NULL)) + offset); | ||
} | ||
|
||
template<typename T> | ||
void WriteMemory(std::uintptr_t offset, const T& data) | ||
{ | ||
void* v_global_ptr = ReadPtr<void>(offset); | ||
|
||
DWORD v_old_protect; | ||
VirtualProtect(v_global_ptr, sizeof(T), PAGE_EXECUTE_READWRITE, &v_old_protect); | ||
std::memcpy(v_global_ptr, &data, sizeof(T)); | ||
VirtualProtect(v_global_ptr, sizeof(T), v_old_protect, &v_old_protect); | ||
} | ||
} |
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,34 @@ | ||
#pragma once | ||
|
||
#include "SmSdk/Util/Memory.hpp" | ||
|
||
#include <cstddef> | ||
#include <cstdint> | ||
|
||
template<typename T, std::uintptr_t t_static_offset> | ||
class StaticVariable | ||
{ | ||
public: | ||
StaticVariable() = default; | ||
|
||
StaticVariable(const T& val) | ||
{ | ||
Memory::WriteMemory<T>(t_static_offset, val); | ||
} | ||
|
||
inline void operator=(const T& val) noexcept | ||
{ | ||
Memory::WriteMemory<T>(t_static_offset, val); | ||
} | ||
|
||
//Be careful when writing data to the pointer, the data might be protected | ||
inline const T* operator&() noexcept | ||
{ | ||
return Memory::ReadPtr<T>(t_static_offset); | ||
} | ||
|
||
inline operator T() | ||
{ | ||
return *Memory::ReadPtr<T>(t_static_offset); | ||
} | ||
}; |
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