1
0
mirror of synced 2024-11-23 22:51:02 +01:00

Add song limit fix

This commit is contained in:
BroGamer 2022-10-13 09:09:13 +13:00
parent cd01d5cbc7
commit b431323ab9
14 changed files with 541 additions and 76 deletions

View File

@ -11,6 +11,12 @@ jobs:
submodules: recursive
- name: Install depends
run: sudo apt-get install -y mingw-w64 clang
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: x86_64-pc-windows-gnu
override: true
components: rust-src
- name: Make
run: |
make dist-no-7z

View File

@ -41,25 +41,28 @@ ${OUT}: dirs ${DEPS} ${OBJ}
.PHONY: fmt
fmt:
@cd src && clang-format -i *.h *.c -style=file
@cd patches/8.18 && clang-format -i *.c -style=file
@cd patches/amauth && clang-format -i *.c -style=file
@cd plugins/8.18 && clang-format -i *.c -style=file
@cd plugins/amauth && clang-format -i *.c -style=file
.PHONY: clean
clean:
rm -rf ${TARGET}
.PHONY: patches
patches:
make -C patches/8.18
make -C patches/amauth
.PHONY: plugins
plugins:
make -C plugins/8.18
make -C plugins/amauth
cd plugins/8.18-song-limit && cargo build --release --target x86_64-pc-windows-gnu -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
cp plugins/8.18-song-limit/target/x86_64-pc-windows-gnu/release/song_limit_8_18.dll ${TARGET}
.PHONY: dist-no-7z
dist-no-7z: options ${OUT} patches
dist-no-7z: options ${OUT} plugins
mkdir -p out/plugins
cp ${TARGET}/${OUT}.dll out/
mv out/${OUT}.dll out/bnusio.dll
cp ${TARGET}/patches.*.dll out/plugins
cp ${TARGET}/plugins.*.dll out/plugins
cp ${TARGET}/amauth.dll out/plugins
cp ${TARGET}/song_limit_8_18.dll out/plugins
cp -r dist/* out/
.PHONY: dist

View File

@ -37,3 +37,11 @@ Runs when user presses CARD_INSERT_1, causes TAL to not insert a card if any plu
void Card2Insert()
```
Runs when user presses CARD_INSERT_2, causes TAL to not insert a card if any plugins have this present
```
void AfterCard1Insert()
```
Runs after CARD_INSERT_1 is handled
```
void AfterCard2Insert()
```
Runs after CARD_INSERT_2 is handled

View File

@ -1,62 +0,0 @@
#define BASE_ADDRESS 0x140000000
#include "helpers.h"
HOOK_DYNAMIC (u8, __fastcall, qrVtable1, u64 a1) { return 1; }
HOOK_DYNAMIC (u8, __fastcall, qrReadFromCOM1, u64 a1) {
*(u32 *)(a1 + 40) = 1;
*(u32 *)(a1 + 16) = 1;
return 1;
}
void
PreInit () {
toml_table_t *config = openConfig (configPath ("plugins/patches.toml"));
if (!config) return;
void *handle = GetModuleHandle (0);
WRITE_MEMORY (ASLR (0x1400239C0, handle), u8, 0xC3); // Stop error
if (readConfigBool (config, "unlock_songs", true)) WRITE_MEMORY (ASLR (0x140314E8D, handle), u8, 0xB0, 0x01); // Unlock songs
if (readConfigBool (config, "shared_audio", true)) WRITE_MEMORY (ASLR (0x140692E17, handle), u8, 0xEB); // Shared audio
// Remove song limit
WRITE_MEMORY (ASLR (0x140313726, handle), u8, 0x28, 0x23);
/* Unfinished network stuff
WRITE_MEMORY (ASLR (0x1402F39E6, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x1402F3AB0, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x1402F3BE4, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x14030643B, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x140306507, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x1403065D3, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x1403066FB, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x1403067C7, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x140306893, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x14030698B, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x140313666, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x140313B04, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x140313C24, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x140313CF4, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x1403140C4, handle), u8, 0x28, 0x23);
WRITE_MEMORY (ASLR (0x1403147AA, handle), u8, 0x28, 0x23);
*/
if (!readConfigBool (config, "vsync", false)) WRITE_MEMORY (ASLR (0x140517339, handle), u8, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x90); // Disable VSync
// Save settings cross session without F:/ and G:/ drive
WRITE_MEMORY (ASLR (0x140B5C528, handle), u8, "./Setting1.bin");
WRITE_MEMORY (ASLR (0x140B5C538, handle), u8, "./Setting2.bin");
// Move F:/ files to current directory
WRITE_MEMORY (ASLR (0x140B1B4B0, handle), u8, "./");
WRITE_MEMORY (ASLR (0x14001C941, handle), u8, 0x02);
// Patch TLS v1.0 to v1.2
WRITE_MEMORY (ASLR (0x14044b1a9, handle), u8, 0x10);
// Move various files to current directory
void *amHandle = GetModuleHandle ("AMFrameWork.dll");
WRITE_MEMORY (amHandle + 0x33EF7, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x3404A, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x34429, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x3457C, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x3497A, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x34ACD, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x148AF, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x14A1A, u8, 0xEB);
INSTALL_HOOK_DYNAMIC (qrVtable1, amHandle + 0x1BA00);
INSTALL_HOOK_DYNAMIC (qrReadFromCOM1, amHandle + 0x1BC20);
}

1
plugins/8.18-song-limit/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
target/

134
plugins/8.18-song-limit/Cargo.lock generated Normal file
View File

@ -0,0 +1,134 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "asm_codegen"
version = "0.1.0"
dependencies = [
"rand",
]
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "getrandom"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "libc"
version = "0.2.135"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c"
[[package]]
name = "mach"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
dependencies = [
"libc",
]
[[package]]
name = "ppv-lite86"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom",
]
[[package]]
name = "region"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e"
dependencies = [
"bitflags",
"libc",
"mach",
"winapi",
]
[[package]]
name = "song-limit-8-18"
version = "0.1.0"
dependencies = [
"asm_codegen",
"libc",
"region",
"winapi",
]
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

View File

@ -0,0 +1,13 @@
[package]
name = "song-limit-8-18"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib"]
[dependencies]
libc = "0.2.133"
asm_codegen = { path = "/home/brogamer/asm_macros/asm_codegen" }
region = "3.0.0"
winapi = { version = "0.3.9", features = ["libloaderapi"] }

View File

@ -0,0 +1 @@
hard_tabs = true

View File

@ -0,0 +1,271 @@
#![allow(non_snake_case)]
use libc::*;
use std::arch::*;
use winapi::um::libloaderapi::*;
const SONG_DATA_SIZE: usize = 1024 * 1024 * 64;
static mut SONG_DATA: Option<*mut c_void> = None;
static mut HANDLE: Option<usize> = None;
pub unsafe fn gen_jmp(to: usize) -> Box<[u8]> {
// MOV RAX, {TO}
// JMP RAX
Box::new([
0x48,
0xB8,
to as u8,
(to >> 8) as u8,
(to >> 16) as u8,
(to >> 24) as u8,
(to >> 32) as u8,
(to >> 40) as u8,
(to >> 48) as u8,
(to >> 56) as u8,
0xFF,
0xE0,
])
}
macro_rules! primitive_ptr {
($function:expr) => {
$function as *mut ()
};
}
macro_rules! set_crown_data {
($offset:literal, $value:literal) => {
asm!(
"add rsp, 0x28",
"mov rax, qword ptr [rsp + 0x40]",
"add rax, r14",
"lea rcx, [rax + rax * 8]",
concat!("cmp dword ptr [rdx + rcx * 8 + 0x300], ", $value),
"jge 1f",
concat!("mov dword ptr [rdx + rcx * 8 + 0x300], ", $value),
"1:",
"jmp r9",
in("rdx") SONG_DATA.unwrap(),
in("r9") HANDLE.unwrap() + $offset,
)
};
}
pub unsafe fn set_crown_data_1() {
set_crown_data!(0x2F3AF1, 1);
}
pub unsafe fn set_crown_data_2() {
set_crown_data!(0x2F3A27, 2);
}
pub unsafe fn set_crown_data_3() {
set_crown_data!(0x2F3C25, 3);
}
macro_rules! set_score_rank {
($offset:literal, $value:literal) => {
asm!(
"add rsp, 0x28",
"lea rcx, [0xB + RBX * 4]",
"add rcx, rsi",
"add rcx, rbx",
"lea rax, [rcx + rcx * 8]",
concat!("cmp dword ptr [rdx + rax * 8], ", $value),
"jge 1f",
concat!("mov dword ptr [rdx + rax * 8], ", $value),
"1:",
"jmp r9",
in("rdx") SONG_DATA.unwrap(),
in("r9") HANDLE.unwrap() + $offset,
);
};
}
pub unsafe fn set_score_rank_1() {
set_score_rank!(0x306613, 1);
}
pub unsafe fn set_score_rank_2() {
set_score_rank!(0x306547, 2);
}
pub unsafe fn set_score_rank_3() {
set_score_rank!(0x30647B, 3);
}
pub unsafe fn set_score_rank_4() {
set_score_rank!(0x3068D3, 4);
}
pub unsafe fn set_score_rank_5() {
set_score_rank!(0x306807, 5);
}
pub unsafe fn set_score_rank_6() {
set_score_rank!(0x30673B, 6);
}
pub unsafe fn set_score_rank_7() {
set_score_rank!(0x3069D0, 7);
}
pub unsafe fn set_unknown_data_1() {
asm!(
"add rsp, 0x28",
"lea rcx, [rsi + rsi * 4]",
"add rcx, rdi",
"lea rax, [rcx + rcx * 8]",
"jmp r15",
in("rdx") SONG_DATA.unwrap(),
in("r15") HANDLE.unwrap() + 0x31376A,
);
}
pub unsafe fn set_unknown_data_2() {
asm!(
"add rsp, 0x28",
"lea rcx, [rdi + rdi * 4]",
"add rcx, rbx",
"lea rax, [rcx + rcx * 8]",
"jmp r8",
in("rdx") SONG_DATA.unwrap(),
in("r8") HANDLE.unwrap() + 0x313A20,
);
}
pub unsafe fn set_unknown_data_3() {
asm!(
"add rsp, 0x28",
"lea rcx, [rdi + rdi * 4]",
"add rcx, rbx",
"lea rax, [rcx + rcx * 8]",
"jmp r10",
in("rdx") SONG_DATA.unwrap(),
in("r10") HANDLE.unwrap() + 0x313B61,
);
}
pub unsafe fn set_unknown_data_4() {
asm!(
"add rsp, 0x28",
"lea rdx, [rdi + rdi * 4]",
"add rdx, rbx",
"lea rdx, [rdx + rdx * 8]",
"jmp rax",
in("r8") SONG_DATA.unwrap(),
in("rax") HANDLE.unwrap() + 0x313C57,
);
}
pub unsafe fn set_unknown_data_other() {
asm!(
"add rsp, 0x28",
"lea rcx, [rdi + rdi * 4]",
"lea rax, [rbx + 0xB]",
"add rcx, rax",
"lea rax, [rcx + rcx * 8]",
"jmp r10",
in("rdx") SONG_DATA.unwrap(),
in("r10") HANDLE.unwrap() + 0x313D51,
);
}
pub unsafe fn set_crown_data_other() {
asm!(
"add rsp, 0x28",
"lea rdx, [rdi + rdi * 4]",
"add rdx, rbx",
"lea rax, [rdx + rdx * 8]",
"mov byte ptr [r8 + rax * 8 + 0x31C], 1",
"jmp rcx",
in("r8") SONG_DATA.unwrap(),
in("rcx") HANDLE.unwrap() + 0x3140EC,
);
}
pub unsafe fn set_song_data() {
asm!(
"add rsp, 0x28",
"movsxd rax, edi",
"lea rdx, [rax + rax * 4]",
"movsxd rdx, ebx",
"add rdx, rax",
"lea rax, [rdx + rdx * 8]",
"lea rbx, [r8 + rax * 8]",
"jmp rcx",
in("r8") SONG_DATA.unwrap(),
in("rcx") HANDLE.unwrap() + 0x31369A,
);
}
#[no_mangle]
pub unsafe extern "C" fn Init() {
let handle = GetModuleHandleA(0 as *const i8) as usize;
HANDLE = Some(handle);
SONG_DATA = Some(calloc(1, SONG_DATA_SIZE));
let bytes = gen_jmp(primitive_ptr!(set_crown_data_1) as usize);
write_bytes(primitive_ptr!(handle + 0x2F3AC8), bytes);
let bytes = gen_jmp(primitive_ptr!(set_crown_data_2) as usize);
write_bytes(primitive_ptr!(handle + 0x2F39FE), bytes);
let bytes = gen_jmp(primitive_ptr!(set_crown_data_3) as usize);
write_bytes(primitive_ptr!(handle + 0x2F3BFC), bytes);
let bytes = gen_jmp(primitive_ptr!(set_score_rank_1) as usize);
write_bytes(primitive_ptr!(handle + 0x3065EA), bytes);
let bytes = gen_jmp(primitive_ptr!(set_score_rank_2) as usize);
write_bytes(primitive_ptr!(handle + 0x30651E), bytes);
let bytes = gen_jmp(primitive_ptr!(set_score_rank_3) as usize);
write_bytes(primitive_ptr!(handle + 0x306452), bytes);
let bytes = gen_jmp(primitive_ptr!(set_score_rank_4) as usize);
write_bytes(primitive_ptr!(handle + 0x3068AA), bytes);
let bytes = gen_jmp(primitive_ptr!(set_score_rank_5) as usize);
write_bytes(primitive_ptr!(handle + 0x3067DE), bytes);
let bytes = gen_jmp(primitive_ptr!(set_score_rank_6) as usize);
write_bytes(primitive_ptr!(handle + 0x306712), bytes);
let bytes = gen_jmp(primitive_ptr!(set_score_rank_7) as usize);
write_bytes(primitive_ptr!(handle + 0x3069A2), bytes);
let bytes = gen_jmp(primitive_ptr!(set_unknown_data_1) as usize);
write_bytes(primitive_ptr!(handle + 0x313755), bytes);
let bytes = gen_jmp(primitive_ptr!(set_unknown_data_2) as usize);
write_bytes(primitive_ptr!(handle + 0x313A0B), bytes);
let bytes = gen_jmp(primitive_ptr!(set_unknown_data_3) as usize);
write_bytes(primitive_ptr!(handle + 0x313B4C), bytes);
let bytes = gen_jmp(primitive_ptr!(set_unknown_data_4) as usize);
write_bytes(primitive_ptr!(handle + 0x313C42), bytes);
let bytes = gen_jmp(primitive_ptr!(set_unknown_data_other) as usize);
write_bytes(primitive_ptr!(handle + 0x313D38), bytes);
let bytes = gen_jmp(primitive_ptr!(set_crown_data_other) as usize);
write_bytes(primitive_ptr!(handle + 0x3140D7), bytes);
let bytes = gen_jmp(primitive_ptr!(set_song_data) as usize);
write_bytes(primitive_ptr!(handle + 0x31367B), bytes);
}
#[no_mangle]
pub unsafe extern "C" fn AfterCard1Insert() {
memset(SONG_DATA.unwrap(), 0, SONG_DATA_SIZE);
}
#[no_mangle]
pub unsafe extern "C" fn AfterCard2Insert() {
memset(SONG_DATA.unwrap(), 0, SONG_DATA_SIZE);
}
pub unsafe fn write_bytes<T>(location: *mut T, bytes: Box<[u8]>) -> Option<()> {
region::protect(
location,
bytes.len(),
region::Protection::READ_WRITE_EXECUTE,
)
.ok()?;
memcpy(
location as *mut libc::c_void,
std::ptr::addr_of!(*bytes) as *mut c_void,
bytes.len(),
);
Some(())
}

View File

@ -2,7 +2,7 @@ OUT = patches.8.18
CC := clang
TARGET := x86_64-pc-windows-gnu
SRC = dllmain.c
OBJ = ${addprefix ../../${TARGET}/patches/8.18/,${SRC:.c=.o}}
OBJ = ${addprefix ../../${TARGET}/plugins/8.18/,${SRC:.c=.o}}
EXTERN_SRC = src/helpers.c tomlc99/toml.c minhook/src/buffer.c minhook/src/hook.c minhook/src/trampoline.c minhook/src/hde/hde32.c minhook/src/hde/hde64.c
EXTERN_OBJ = ${addprefix ../../${TARGET}/,${EXTERN_SRC:.c=.o}}
CFLAGS = -std=c99 -I../../src -I../../minhook/include -I../../tomlc99 -Wall -Ofast -target ${TARGET} -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=_WIN32_WINNT_WIN7
@ -13,7 +13,7 @@ all: options ${OUT}
.PHONY: dirs
dirs:
@mkdir -p ../../${TARGET}/patches/8.18
@mkdir -p ../../${TARGET}/plugins/8.18
.PHONY: options
options:
@ -21,7 +21,7 @@ options:
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
../../${TARGET}/patches/8.18/%.o: %.c
../../${TARGET}/plugins/8.18/%.o: %.c
@echo BUILD $@
@${CC} -c ${CFLAGS} $< -o $@

82
plugins/8.18/dllmain.c Normal file
View File

@ -0,0 +1,82 @@
#define BASE_ADDRESS 0x140000000
#include "helpers.h"
HOOK_DYNAMIC (u8, __fastcall, qrVtable1, u64 a1) { return 1; }
HOOK_DYNAMIC (u8, __fastcall, qrReadFromCOM1, u64 a1) {
*(u32 *)(a1 + 40) = 1;
*(u32 *)(a1 + 16) = 1;
return 1;
}
void
PreInit () {
toml_table_t *config = openConfig (configPath ("plugins/patches.toml"));
if (!config) return;
void *handle = GetModuleHandle (0);
WRITE_MEMORY (ASLR (0x1400239C0, handle), u8, 0xC3); // Stop error
if (readConfigBool (config, "unlock_songs", true)) WRITE_MEMORY (ASLR (0x140314E8D, handle), u8, 0xB0, 0x01); // Unlock songs
if (readConfigBool (config, "shared_audio", true)) WRITE_MEMORY (ASLR (0x140692E17, handle), u8, 0xEB); // Shared audio
// Remove song limit
WRITE_MEMORY (ASLR (0x140313726, handle), u8, 0x28, 0x23);
// Remove for with server
WRITE_MEMORY (ASLR (0x1402F39E6, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1402F3AB0, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1402F3BE4, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x14030643B, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140306507, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1403065D3, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1403066FB, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1403067C7, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140306893, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x14030698B, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140313666, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140313726, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1403139F4, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140313B04, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140313C24, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140313CF4, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1403140C4, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1403147AA, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140225FB6, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140226146, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140314DCC, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140314EC9, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140338E2C, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1400EE0A4, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1400EE8B5, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1400EEDA6, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140315608, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x14034A7EB, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x1402F3CB3, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140314059, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140226063, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x14022609F, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140226296, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140306A2E, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140314F46, handle), i32, 4000);
WRITE_MEMORY (ASLR (0x140314F97, handle), i32, 4000);
if (!readConfigBool (config, "vsync", false)) WRITE_MEMORY (ASLR (0x140517339, handle), u8, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x90); // Disable VSync
// Save settings cross session without F:/ and G:/ drive
WRITE_MEMORY (ASLR (0x140B5C528, handle), u8, "./Setting1.bin");
WRITE_MEMORY (ASLR (0x140B5C538, handle), u8, "./Setting2.bin");
// Move F:/ files to current directory
WRITE_MEMORY (ASLR (0x140B1B4B0, handle), u8, "./");
WRITE_MEMORY (ASLR (0x14001C941, handle), u8, 0x02);
// Patch TLS v1.0 to v1.2
WRITE_MEMORY (ASLR (0x14044b1a9, handle), u8, 0x10);
// Move various files to current directory
void *amHandle = GetModuleHandle ("AMFrameWork.dll");
WRITE_MEMORY (amHandle + 0x33EF7, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x3404A, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x34429, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x3457C, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x3497A, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x34ACD, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x148AF, u8, 0xEB);
WRITE_MEMORY (amHandle + 0x14A1A, u8, 0xEB);
INSTALL_HOOK_DYNAMIC (qrVtable1, amHandle + 0x1BA00);
INSTALL_HOOK_DYNAMIC (qrReadFromCOM1, amHandle + 0x1BC20);
}

View File

@ -2,7 +2,7 @@ OUT = amauth
CXX := x86_64-w64-mingw32-g++
TARGET := x86_64-pc-windows-gnu
SRC = dllmain.cpp
OBJ = ${addprefix ../../${TARGET}/patches/amauth/,${SRC:.cpp=.o}}
OBJ = ${addprefix ../../${TARGET}/plugins/amauth/,${SRC:.cpp=.o}}
EXTERN_SRC = src/helpers.c tomlc99/toml.c minhook/src/buffer.c minhook/src/hook.c minhook/src/trampoline.c minhook/src/hde/hde32.c minhook/src/hde/hde64.c
EXTERN_OBJ = ${addprefix ../../${TARGET}/,${EXTERN_SRC:.c=.o}}
CXXFLAGS = -std=c++11 -I../../src -I../../minhook/include -I../../tomlc99 -Wall -Ofast -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=_WIN32_WINNT_WIN7
@ -13,7 +13,7 @@ all: options ${OUT}
.PHONY: dirs
dirs:
@mkdir -p ../../${TARGET}/patches/amauth
@mkdir -p ../../${TARGET}/plugins/amauth
.PHONY: options
options:
@ -21,7 +21,7 @@ options:
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CXX = ${CXX}"
../../${TARGET}/patches/amauth/%.o: %.cpp
../../${TARGET}/plugins/amauth/%.o: %.cpp
@echo BUILD $@
@${CXX} -c ${CXXFLAGS} $< -o $@

View File

@ -127,6 +127,10 @@ u16 __fastcall bnusio_GetCoin (i32 a1) {
memcpy (cardData + 0x50, accessCode1, 21);
touchCallback (0, 0, cardData, touchData);
}
for (int i = 0; plugins[i] != 0; i++) {
FARPROC insertEvent = GetProcAddress (plugins[i], "AfterCard1Insert");
if (insertEvent) ((event *)insertEvent) ();
}
} else if (IsButtonTapped (CARD_INSERT_2)) {
for (int i = 0; plugins[i] != 0; i++) {
FARPROC insertEvent = GetProcAddress (plugins[i], "Card2Insert");
@ -138,6 +142,10 @@ u16 __fastcall bnusio_GetCoin (i32 a1) {
memcpy (cardData + 0x50, accessCode2, 21);
touchCallback (0, 0, cardData, touchData);
}
for (int i = 0; plugins[i] != 0; i++) {
FARPROC insertEvent = GetProcAddress (plugins[i], "AfterCard2Insert");
if (insertEvent) ((event *)insertEvent) ();
}
}
}
for (int i = 0; plugins[i] != 0; i++) {