Add option to auto change to English IME
This commit is contained in:
parent
c592bccad4
commit
08fac83109
@ -36,6 +36,8 @@ res = { x = 1920, y = 1080 }
|
|||||||
windowed = false
|
windowed = false
|
||||||
# vertical sync
|
# vertical sync
|
||||||
vsync = false
|
vsync = false
|
||||||
|
# auto change to english ime mode
|
||||||
|
auto_ime = false
|
||||||
# unlock all songs
|
# unlock all songs
|
||||||
unlock_songs = true
|
unlock_songs = true
|
||||||
|
|
||||||
|
1
dist/config.toml
vendored
1
dist/config.toml
vendored
@ -11,6 +11,7 @@ version = "auto"
|
|||||||
res = { x = 1920, y = 1080 }
|
res = { x = 1920, y = 1080 }
|
||||||
windowed = false
|
windowed = false
|
||||||
vsync = false
|
vsync = false
|
||||||
|
auto_ime = false
|
||||||
unlock_songs = true
|
unlock_songs = true
|
||||||
|
|
||||||
[patches.audio]
|
[patches.audio]
|
||||||
|
@ -3,12 +3,13 @@
|
|||||||
#include "patches/patches.h"
|
#include "patches/patches.h"
|
||||||
#include "poll.h"
|
#include "poll.h"
|
||||||
|
|
||||||
|
extern GameVersion version;
|
||||||
extern std::vector<HMODULE> plugins;
|
extern std::vector<HMODULE> plugins;
|
||||||
extern char accessCode1[21];
|
extern char accessCode1[21];
|
||||||
extern char chipId1[33];
|
|
||||||
extern char accessCode2[21];
|
extern char accessCode2[21];
|
||||||
|
extern char chipId1[33];
|
||||||
extern char chipId2[33];
|
extern char chipId2[33];
|
||||||
extern GameVersion version;
|
extern bool autoIME;
|
||||||
|
|
||||||
typedef i32 (*callbackAttach) (i32, i32, i32 *);
|
typedef i32 (*callbackAttach) (i32, i32, i32 *);
|
||||||
typedef void (*callbackTouch) (i32, i32, u8[168], u64);
|
typedef void (*callbackTouch) (i32, i32, u8[168], u64);
|
||||||
@ -162,14 +163,20 @@ bnusio_GetAnalogIn (u8 which) {
|
|||||||
bool testEnabled = false;
|
bool testEnabled = false;
|
||||||
int coin_count = 0;
|
int coin_count = 0;
|
||||||
bool inited = false;
|
bool inited = false;
|
||||||
HWND windowHandle = 0;
|
HWND windowHandle = nullptr;
|
||||||
|
HKL currentLayout;
|
||||||
|
|
||||||
u16 __fastcall bnusio_GetCoin (i32 a1) {
|
u16 __fastcall bnusio_GetCoin (i32 a1) {
|
||||||
if (a1 != 1) return coin_count;
|
if (a1 != 1) return coin_count;
|
||||||
|
|
||||||
if (!inited) {
|
if (!inited) {
|
||||||
windowHandle = FindWindowA ("nuFoundation.Window", 0);
|
windowHandle = FindWindowA ("nuFoundation.Window", nullptr);
|
||||||
InitializePoll (windowHandle);
|
InitializePoll (windowHandle);
|
||||||
|
if (autoIME) {
|
||||||
|
currentLayout = GetKeyboardLayout (0);
|
||||||
|
auto engLayout = LoadKeyboardLayout (TEXT ("00000409"), KLF_ACTIVATE);
|
||||||
|
ActivateKeyboardLayout (engLayout, KLF_SETFORPROCESS);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto plugin : plugins) {
|
for (auto plugin : plugins) {
|
||||||
auto initEvent = GetProcAddress (plugin, "Init");
|
auto initEvent = GetProcAddress (plugin, "Init");
|
||||||
@ -253,6 +260,7 @@ bnusio_GetSwIn () {
|
|||||||
|
|
||||||
i64
|
i64
|
||||||
bnusio_Close () {
|
bnusio_Close () {
|
||||||
|
if (autoIME) ActivateKeyboardLayout (currentLayout, KLF_SETFORPROCESS);
|
||||||
for (auto plugin : plugins) {
|
for (auto plugin : plugins) {
|
||||||
FARPROC exitEvent = GetProcAddress (plugin, "Exit");
|
FARPROC exitEvent = GetProcAddress (plugin, "Exit");
|
||||||
if (exitEvent) ((event *)exitEvent) ();
|
if (exitEvent) ((event *)exitEvent) ();
|
||||||
|
@ -19,6 +19,7 @@ char accessCode1[21] = "00000000000000000001";
|
|||||||
char accessCode2[21] = "00000000000000000002";
|
char accessCode2[21] = "00000000000000000002";
|
||||||
char chipId1[33] = "00000000000000000000000000000001";
|
char chipId1[33] = "00000000000000000000000000000001";
|
||||||
char chipId2[33] = "00000000000000000000000000000002";
|
char chipId2[33] = "00000000000000000000000000000002";
|
||||||
|
bool autoIME = false;
|
||||||
|
|
||||||
HOOK (i32, ShowMouse, PROC_ADDRESS ("user32.dll", "ShowCursor"), bool) { return originalShowMouse (true); }
|
HOOK (i32, ShowMouse, PROC_ADDRESS ("user32.dll", "ShowCursor"), bool) { return originalShowMouse (true); }
|
||||||
HOOK (i32, ExitWindows, PROC_ADDRESS ("user32.dll", "ExitWindowsEx")) { ExitProcess (0); }
|
HOOK (i32, ExitWindows, PROC_ADDRESS ("user32.dll", "ExitWindowsEx")) { ExitProcess (0); }
|
||||||
@ -121,7 +122,10 @@ DllMain (HMODULE module, DWORD reason, LPVOID reserved) {
|
|||||||
std::strcat (placeId, "0FF0");
|
std::strcat (placeId, "0FF0");
|
||||||
}
|
}
|
||||||
auto patches = openConfigSection (config, "patches");
|
auto patches = openConfigSection (config, "patches");
|
||||||
if (patches) version = readConfigString (patches, "version", version);
|
if (patches) {
|
||||||
|
version = readConfigString (patches, "version", version);
|
||||||
|
autoIME = readConfigBool (patches, "auto_ime", autoIME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version == "auto") {
|
if (version == "auto") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user