1.0.0.1 [vcmp.log in game folder] by isweikton · Pull Request #11 · fet1sov/VCMP-Android · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Binary file modified ready-lib/arm64-v8a/libVCMP.so
Binary file not shown.
Binary file modified ready-lib/armeabi-v7a/libVCMP.so
Binary file not shown.
2 changes: 1 addition & 1 deletion src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CGame::CGame()

void CGame::InitGame()
{
LOGI("libGTAVC.so: Game has been inited!");
LOGI("> Inject game...");

ApplyPatches();
InitScripting();
Expand Down
4 changes: 2 additions & 2 deletions src/game/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ void TouchEvent_hook(int type, int num, int posX, int posY)
void (*NvUtilInit)();
void NvUtilInit_hook()
{
LOGI("> NvUtilInit");
NvUtilInit();

// .. vc
Expand All @@ -25,11 +24,12 @@ void NvUtilInit_hook()

// .. client
g_pStorage = (char*)(g_libGTAVC + NV_STORAGE);
LOGI("> Custom Storage: %s", g_pStorage);
Log("> Custom Storage: %s", g_pStorage);
}

void InstallHooks()
{
LOGI("> Inject hooks...");
InstallHook(g_libGTAVC+HOOK_NVINIT, (uintptr_t)NvUtilInit_hook, (uintptr_t*)NvUtilInit);
InstallHook(g_libGTAVC+HOOK_TOUCHEVENT, (uintptr_t)TouchEvent_hook, (uintptr_t*)&TouchEvent);
}
2 changes: 1 addition & 1 deletion src/game/patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

void ApplyPatches()
{
LOGI("libGTAVC.so: Patching the game...");
LOGI("> Inject pacthes...");

WriteMemory(g_libGTAVC+CLOCK_DATA, "VC:MP", 6);

Expand Down
29 changes: 29 additions & 0 deletions src/log.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Created by weikton on 08.06.2025.
//
#include "log.h"
#include "main.h"

void Log(const char *fmt, ...)
{
static char buffer[512] {};
memset(buffer, 0, sizeof(buffer));

va_list arg;
va_start(arg, fmt);
vsnprintf(buffer, sizeof(buffer), fmt, arg);
va_end(arg);

static FILE* flLog = nullptr;

if(flLog == nullptr && g_pStorage != nullptr)
{
sprintf(buffer, "%svcmp.log", g_pStorage);
flLog = fopen(buffer, "ab");
}

if(flLog == nullptr)
return;
fprintf(flLog, "%s\n", buffer);
fflush(flLog);
}
11 changes: 11 additions & 0 deletions src/log.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// Created by weikton on 08.06.2025.
//
#pragma once
#include <string>
#include <android/log.h>

void Log(const char *fmt, ...);

#define LOG_TAG "VICEMP"
#define LOGI(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
4 changes: 2 additions & 2 deletions src/main.h