-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add patterns for showing menu in all games
- Loading branch information
1 parent
f9f7a8d
commit db47a29
Showing
10 changed files
with
169 additions
and
14 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
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
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,62 @@ | ||
#include <stdio.h> | ||
#include <stdarg.h> | ||
|
||
#include <MinHook.h> | ||
|
||
#include "Font.h" | ||
#include "util/Hooking.h" | ||
|
||
static std::function<void()> s_callback; | ||
|
||
// Font::Flush | ||
static void(* s_Flush)(); | ||
|
||
static void Flush() | ||
{ | ||
s_callback(); | ||
s_Flush(); | ||
} | ||
|
||
char Font::s_formatted[1024]; | ||
|
||
Font* Font::GetMainFont() | ||
{ | ||
return *(Font**)0x7D1800; | ||
} | ||
|
||
void Font::SetCursor(float x, float y) | ||
{ | ||
Hooking::Call(0x433C70, x, y); | ||
} | ||
|
||
void Font::SetScale(float scaleX, float scaleY) | ||
{ | ||
Hooking::Call(0x433E60, scaleX, scaleY); | ||
} | ||
|
||
void Font::Print(const char* fmt, ...) | ||
{ | ||
va_list va; | ||
|
||
va_start(va, fmt); | ||
vsprintf_s(s_formatted, fmt, va); | ||
va_end(va); | ||
|
||
PrintFormatted(s_formatted); | ||
} | ||
|
||
void Font::PrintFormatted(const char* formatted, int backdrop) | ||
{ | ||
Hooking::ThisCall(0x434A70, this, formatted, backdrop); | ||
} | ||
|
||
void Font::OnFlush(std::function<void()> callback) | ||
{ | ||
if (!s_callback) | ||
{ | ||
MH_CreateHook((void*)0x434C40, Flush, (void**)&s_Flush); | ||
MH_EnableHook(MH_ALL_HOOKS); | ||
} | ||
|
||
s_callback = callback; | ||
} |
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,20 @@ | ||
#pragma once | ||
|
||
#include <functional> | ||
|
||
class Font | ||
{ | ||
private: | ||
static char s_formatted[1024]; | ||
|
||
public: | ||
static Font* GetMainFont(); | ||
|
||
static void SetCursor(float x, float y); | ||
static void SetScale(float scaleX, float scaleY); | ||
|
||
void Print(const char* fmt, ...); | ||
void PrintFormatted(const char* formatted, int backdrop = 0); | ||
|
||
static void OnFlush(std::function<void()> callback); | ||
}; |
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