Skip to content

Commit

Permalink
修改窗口添加英文
Browse files Browse the repository at this point in the history
  • Loading branch information
StArrayJaN committed Oct 17, 2023
1 parent 3887b98 commit 95136bc
Show file tree
Hide file tree
Showing 7 changed files with 294 additions and 53 deletions.
4 changes: 0 additions & 4 deletions .gitignore.bak

This file was deleted.

Binary file modified app/libs/arm64-v8a/libmui.so
Binary file not shown.
2 changes: 0 additions & 2 deletions app/src/main/java/thercn/wmw/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ protected void onCreate(Bundle savedInstanceState) {
Date lastModifiedDate = new Date(lastModifiedTime);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formattedDate = dateFormat.format(lastModifiedDate);

checkObb.setText(getString(R.string.have_obb) + formattedDate);
}
String obbPath = getObbPath();
Expand Down Expand Up @@ -92,7 +91,6 @@ public String getObbPath() {
try {
packageInfo = packageManager.getPackageInfo(getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {}

String pn = getPackageName();
if (Environment.getExternalStorageState().equals("mounted")) {
File file = Environment.getExternalStorageDirectory();
Expand Down
43 changes: 6 additions & 37 deletions app/src/main/jn/Source/EGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ EGL::EGL() {
mEglSurface = EGL_NO_SURFACE;
mEglConfig = nullptr;
mEglContext = EGL_NO_CONTEXT;
// FPS = 90;
}

static bool RunInitImgui;//检测imgui是否初始化过
Expand All @@ -24,14 +23,12 @@ int EGL::initEgl() {
LOGE("eglGetDisplay error=%u", glGetError());
return -1;
}
LOGE("生成mEglDisplay");
//2、
EGLint *version = new EGLint[2];
if (!eglInitialize(mEglDisplay, &version[0], &version[1])) {
LOGE("eglInitialize error=%u", glGetError());
return -1;
}
LOGE("eglInitialize成功");
//3、
const EGLint attribs[] = {EGL_BUFFER_SIZE, 32, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 8, EGL_STENCIL_SIZE, 8, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_NONE};
Expand All @@ -41,13 +38,11 @@ int EGL::initEgl() {
LOGE("eglGetConfigs error =%u", glGetError());
return -1;
}
LOGE("num_config=%d", num_config);
// 4、
if (!eglChooseConfig(mEglDisplay, attribs, &mEglConfig, 1, &num_config)) {
LOGE("eglChooseConfig error=%u", glGetError());
return -1;
}
LOGE("eglChooseConfig成功");
//5、
int attrib_list[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};
mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT, attrib_list);
Expand All @@ -61,13 +56,11 @@ int EGL::initEgl() {
LOGE("eglCreateWindowSurface error = %u", glGetError());
return -1;
}
LOGE("eglCreateWindowSurface成功");
//7、
if (!eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
LOGE("eglMakeCurrent error = %u", glGetError());
return -1;
}
LOGE("eglMakeCurrent成功");
return 1;
}

Expand All @@ -93,17 +86,13 @@ int EGL::initImgui() {
io->IniSavingRate = 10.0f;
string SaveFile = this->SaveDir;
SaveFile += "/save.ini";
// LOGE("保存配置文件的位置:%s",SaveFile.c_str());
io->IniFilename = SaveFile.c_str();




// io->ConfigWindowsMoveFromTitleBarOnly = true;
//ImGui::LoadIniSettingsFromDisk(SaveFile.c_str());
ImGui_ImplAndroid_Init(this->SurfaceWin);
LOGE(" ImGui_ImplAndroid_Init成功");
// ImGui_ImplOpenGL3_Init("#version 100");
ImGui_ImplOpenGL3_Init("#version 300 es");
LOGE(" ImGui_ImplOpenGL3_Init成功");
ImFontConfig font_cfg;
Expand Down Expand Up @@ -159,7 +148,6 @@ void EGL::onSurfaceDestroy() {
this->isDestroy = true;

std::unique_lock<std::mutex> ulo(Threadlk);
//LOGE("onSurfaceDestroy2");
cond.wait(ulo, [this] { return !this->ThreadIo; });
delete SurfaceThread;
SurfaceThread = nullptr;
Expand All @@ -171,20 +159,13 @@ char offset[18];
char str[24];

void EGL::EglThread() {
LOGE("imguidgsbdf成");

//LOGE("EglThreadstrat");
this->initEgl();
// LOGE("Egl初始化完成");
this->initImgui();
// LOGE("imgui初始化完成");
ThreadIo = true;
// AutoFPS.setAffinity();
// getRandomColor(HealthColor, 200, 0.7);
input->initImguiIo(io);
input->setImguiContext(g);
input->setwin(this->g_window);
// LOGE("surfaceWidth=%d,surfaceHigh=%d", this->surfaceWidth, this->surfaceHigh);

while (true) {

Expand All @@ -195,13 +176,9 @@ void EGL::EglThread() {
this->isChage = false;
}
if (this->isDestroy) {
// LOGE("isDes1");
this->isDestroy = false;
// LOGE("isDes2");
ThreadIo = false;
//LOGE("isDes3");
cond.notify_all();
// LOGE("isDes1");
return;
}

Expand All @@ -213,35 +190,27 @@ void EGL::EglThread() {
imguiMainWinStart();

//菜单
// MainView();
ImGui::SetNextWindowBgAlpha(0.7);
//input->ItemActive = ImGui::IsAnyItemActive();
//input->ItemHovered = ImGui::IsAnyItemHovered();
//input->ItemFocused = ImGui::IsAnyItemFocused();
style->WindowTitleAlign = ImVec2(0.5, 0.5);//标题居中
//style->WindowMinSize = ImVec2(900, 800);
// FrameHeight = ImGui::GetFrameHeight();
if (input->Scrollio && !input->Activeio) {
input->funScroll(g->WheelingWindow ? g->WheelingWindow : g->HoveredWindow);
}


ImGui::Begin("menuTest");
ImGui::Begin("Where's My Water?Mod Tool");
input->g_window = g_window = ImGui::GetCurrentWindow();
ImGui::SetWindowSize({500, 500}, ImGuiCond_FirstUseEver);
ImGui::SetWindowPos({0, 200}, ImGuiCond_FirstUseEver);
ImGui::Text("libwmw.so修改工具");
ImGui::Text("libwmw.so Mod Tool");

ImGui::InputTextWithHint("##偏移", "请输入偏移", offset, IM_ARRAYSIZE(offset),
ImGui::InputTextWithHint("##偏移", "请输入偏移(input offset)", offset, IM_ARRAYSIZE(offset),
ImGuiInputTextFlags_CallbackAlways,
ImguiAndroidInput::inputCallback);

ImGui::InputTextWithHint("##字节", "请输入修改的16进制字节,例如00 1A 2B 3C 4D 5E 6A 7B", str, IM_ARRAYSIZE(str),
ImGui::InputTextWithHint("##字节", "请输入hex(input hex)", str, IM_ARRAYSIZE(str),
ImGuiInputTextFlags_CallbackAlways,
ImguiAndroidInput::inputCallback);
if (ImGui::Button("修改")){
patch(offset,str);
LOGE("成功为%d打上%s",offset,str);
if (ImGui::Button("修改(modify)")){
if (patch(offset,str)) LOGE("成功为%d打上%s",offset,str);
}

ImGui::End();
Expand Down
Loading

0 comments on commit 95136bc

Please sign in to comment.