diff --git a/MGR RedTrainer.vcxproj b/MGR RedTrainer.vcxproj index 48bd84f..8f05b2d 100644 --- a/MGR RedTrainer.vcxproj +++ b/MGR RedTrainer.vcxproj @@ -35,7 +35,7 @@ DynamicLibrary false - v142 + v141 true MultiByte @@ -203,6 +203,7 @@ NotUsing + NotUsing diff --git a/src/hooks/EndScene.cpp b/src/hooks/EndScene.cpp index 3767485..1098df3 100644 --- a/src/hooks/EndScene.cpp +++ b/src/hooks/EndScene.cpp @@ -112,7 +112,7 @@ HRESULT __stdcall Base::Hooks::EndScene(LPDIRECT3DDEVICE9 pDevice) if (Data::ShowMenu7) { - RtGui::raidenFlagsWindow(); + RtGui::testWindow(); } if (Data::ShowMenu8) diff --git a/src/trainerFunctions/trainerFunctions.cpp b/src/trainerFunctions/trainerFunctions.cpp index e0917f8..9a6dbdd 100644 --- a/src/trainerFunctions/trainerFunctions.cpp +++ b/src/trainerFunctions/trainerFunctions.cpp @@ -12,7 +12,10 @@ uintptr_t RedTrainer::moduleBase = 0; int(*playAnimation)(unsigned int, int, int, int, int); ///playerPtr, animId, animType, aId2, aType2 int(*getItem)(unsigned int); +unsigned int(*setLessSword)(unsigned int, int); int(*setSound)(int, int); +int(*setBgmFunc)(int); +int(*setMessagePrint)(unsigned int, int, unsigned int, int, int, int, int, int, int); void RedTrainer::setText (bool bActive) { @@ -55,6 +58,30 @@ void RedTrainer::playSound(int soundPtr) } } +void RedTrainer::setBgm(int bgmPtr) +{ + bgmPtr += moduleBase; //0x123CFD8 bgm sam + int bgmFuncAddr = moduleBase + 0xA5E1B0; + setBgmFunc = (int(__cdecl*)(int))bgmFuncAddr; + + __asm { + push bgmPtr + call setBgmFunc + add esp, 4 + } +} +void RedTrainer::setBgm(char bgmText[]) +{ + int bgmFuncAddr = moduleBase + 0xA5E1B0; + setBgmFunc = (int(__cdecl*)(int))bgmFuncAddr; + + __asm { + push [bgmText] + call setBgmFunc + add esp, 4 + } +} + ///STATS void RedTrainer::setInvincibility(bool &bInvincibility) @@ -369,6 +396,22 @@ void RedTrainer::setPlayerHair(int playerHairId) } } +void RedTrainer::setInvisibility(bool &bInvisible) +{ + uintptr_t invisibleAddress; + memcpy(&invisibleAddress, (BYTE*)(moduleBase + 0x19C1490), sizeof(invisibleAddress)); + if (invisibleAddress == NULL) + { + playSound(0x12581AC); + return; + } + bInvisible = !bInvisible; + int invisibleVar = bInvisible; + playSound(0x1257100); + invisibleAddress = mem::in::find_DMA(moduleBase + 0x19C1490, { 0x18C }); + mem::in::write((BYTE*)invisibleAddress, (BYTE*)&invisibleVar, sizeof(invisibleVar)); +} + ///MOVEMENT void RedTrainer::setSpeed(float speedValue) @@ -861,6 +904,31 @@ void RedTrainer::setPlayerAnimation(int animId, int animType, int animIdOld, int } } +void RedTrainer::setWithoutSword(bool &isActive) +{ + int playerPtr = 0; + memcpy(&playerPtr, (BYTE*)(moduleBase + 0x19C1490), sizeof(playerPtr)); + + if (playerPtr == NULL) + { + playSound(0x12581AC); + return; + } + + isActive = !isActive; + + playSound(0x1257100); + int playerSwordType = 1; + int setLessSwordAddr = moduleBase + 0x77E210; + setLessSword = (unsigned int(*)(unsigned int, int))setLessSwordAddr; + + __asm { + push playerSwordType + mov ecx, playerPtr + call setLessSword + } +} + ///MISSION void RedTrainer::setMission(short missionId, char missionName[]) @@ -1061,6 +1129,29 @@ void RedTrainer::setMenuType(char menuType) mem::in::write((BYTE*)(moduleBase + 0x17E9F9C), (BYTE*)&menuType, sizeof(menuType)); } +void RedTrainer::printMessage(unsigned int messageId, int messageNum, int messagePrint, int messagePosition, char messageChar[]) +{ + int setPtrChkMsg = moduleBase + 0x19C3D08; + int setMsgFuncAddr = moduleBase + 0x8E2DB0; + playSound(0x1257100); + //mem::in::read((BYTE*)(moduleBase + 0x19C3D08), (BYTE*)&setPtrChkMsg, sizeof(setPtrChkMsg)); + + setMessagePrint = (int(*)(unsigned int, int, unsigned int, int, int, int, int, int, int))setMsgFuncAddr; + + __asm { + push messagePosition + push 1 + push 0 + push 0 + push messageNum + push messagePrint + push messageId + push 0 + mov ecx, setPtrChkMsg + call setMessagePrint + } +} + ///ENEMY void RedTrainer::setAllEnemies(bool bEnemyActive, unsigned int enemyId, unsigned int enemyType, unsigned int enemySetType, unsigned int enemyFlag) diff --git a/src/trainerFunctions/trainerFunctions.h b/src/trainerFunctions/trainerFunctions.h index 7e5f990..072630e 100644 --- a/src/trainerFunctions/trainerFunctions.h +++ b/src/trainerFunctions/trainerFunctions.h @@ -9,6 +9,10 @@ namespace RedTrainer { void playSound(int soundPtr); + void setBgm(int bgmPtr); + + void setBgm(char bgmText[]); + ///STATS void setInvincibility(bool &Invincibility); @@ -51,6 +55,8 @@ namespace RedTrainer { void setPlayerHair(int playerHairId); + void setInvisibility(bool &bInvisible); + ///MOVEMENT void setSpeed(float speedValue); @@ -59,6 +65,8 @@ namespace RedTrainer { void setPlayerAnimation(int animId, int animType, int animIdOld, int animTypeOld, bool isSelectable); + void setWithoutSword(bool &isActive); + ///MISSION void setMission(short missionId, char missionName[]); @@ -95,6 +103,8 @@ namespace RedTrainer { void setMenuType(char menuType); + void printMessage(unsigned int messageId, int messageNum, int messagePrint, int messagePosition, char messageChar[]); + ///ENEMY void setAllEnemies(bool bEnemyActive, unsigned int enemyId = 0, unsigned int enemyType = 0, unsigned int enemySetType = 0, unsigned int enemyFlag = 0); diff --git a/src/trainerGui/trainerGui.cpp b/src/trainerGui/trainerGui.cpp index 3ef481c..7eec8a4 100644 --- a/src/trainerGui/trainerGui.cpp +++ b/src/trainerGui/trainerGui.cpp @@ -3,15 +3,20 @@ #include "trainerGui.h" #include "trainerFunctions/trainerFunctions.h" -bool bInvicibility = false, - bEnergy = false, - bNoDamage = false, - bNoKilled = false, - bNoAlert = false, - bInfAddWeapon = false, - RtGui::bFly = false; +bool bInvicibility = false, +bEnergy = false, +bNoDamage = false, +bNoKilled = false, +bNoAlert = false, +bInfAddWeapon = false, +isHasSword = false, +RtGui::bFly = false, +RtGui::bTestWindow = false, +bInvisible = false; char missionName[0x20] = "Subphase", + messageChar[0xFF] = { 0 }, + bgmChar[0x40] = "bgm_Paused_Exit", difficultyValue = 0, cRaidenType = 0, cMenuType = 0, @@ -48,13 +53,18 @@ int healthValue = 1600, animationId = 0, ///FOR TEST animationTime = 0, animationIdOld = 0, - animationTimeOld = 0; + animationTimeOld = 0, + messageNum = 0, + messagePrint = 0, + messagePosition = 0; unsigned int enemyId = 0x00020140, enemyTypeId = 0x00000000, enemySetTypeId = 0x00000000, enemyFlagId = 0x00000000, - renderType = 0x00000000; + renderType = 0x00000000, + messageId = 0, + bgmPtr = 0x0; float speedValue = 0.0f, battleTimer = 0.0f, @@ -172,13 +182,6 @@ void RtGui::mainWindow() Base::Data::ShowMenu6 = !Base::Data::ShowMenu6; } - if (ImGui::Button("RAIDEN FLAGS", ImVec2(150, 20))) - { - RedTrainer::playSound(0x12570E8); - RtGui::hideSecondWindow(); - Base::Data::ShowMenu7 = !Base::Data::ShowMenu7; - } - if (ImGui::Button("OTHER", ImVec2(150, 20))) { RedTrainer::playSound(0x12570E8); @@ -193,6 +196,15 @@ void RtGui::mainWindow() Base::Data::ShowMenu9 = !Base::Data::ShowMenu9; } + if (bTestWindow) { + if (ImGui::Button("TEST WINDOW", ImVec2(150, 20))) + { + RedTrainer::playSound(0x12570E8); + RtGui::hideSecondWindow(); + Base::Data::ShowMenu7 = !Base::Data::ShowMenu7; + } + } + ImGui::End(); renderStyle(0); } @@ -581,6 +593,9 @@ void RtGui::customizationWindow() } ImGui::EndCombo(); } + ImGui::SameLine(); + if (ImGui::Button(" ", ImVec2(150, 20))) + bTestWindow = !bTestWindow; if (ImGui::Button("PLAYER BODY", ImVec2(150, 20))) RedTrainer::setPlayerBody(bodyType); @@ -616,6 +631,10 @@ void RtGui::customizationWindow() ImGui::EndCombo(); } + if (ImGui::Button("INVISIBLE", ImVec2(150, 20))) + RedTrainer::setInvisibility(bInvisible); + RedTrainer::setText(bInvisible); + ImGui::End(); renderStyle(0); } @@ -658,17 +677,9 @@ void RtGui::movementWindow() ImGui::EndCombo(); } - ///FOR TEST - /* - if (ImGui::Button("ANIMATION TEST", ImVec2(150, 20))) - RedTrainer::setPlayerAnimation(animationId, animationTime, animationIdOld, animationTimeOld, 0); - ImGui::InputScalar(" ", ImGuiDataType_U32, &animationId); - ImGui::SameLine(); - ImGui::InputScalar(" ", ImGuiDataType_U32, &animationTime); - ImGui::InputScalar(" ", ImGuiDataType_U32, &animationIdOld); - ImGui::SameLine(); - ImGui::InputScalar(" ", ImGuiDataType_U32, &animationTimeOld); - */ + if (ImGui::Button("LOST SWORD", ImVec2(150, 20))) + RedTrainer::setWithoutSword(isHasSword); + //RedTrainer::setText(isHasSword); ImGui::End(); renderStyle(0); @@ -752,7 +763,7 @@ void RtGui::missionWindow() renderStyle(0); } -void RtGui::raidenFlagsWindow() +void RtGui::testWindow() ///FOR TEST { renderStyle(1); @@ -762,29 +773,49 @@ void RtGui::raidenFlagsWindow() ImGuiWindowFlags_AlwaysAutoResize); //ImGui::GetStyle().WindowRounding = 0.0f; - ImGui::Text("RAIDEN FLAGS"); + ImGui::Text("TEST"); - if (ImGui::Button("SET FLAG", ImVec2(150, 20))) - RedTrainer::setFlag(cRaidenType); + if (ImGui::Button("ANIMATION TEST", ImVec2(150, 20))) + RedTrainer::setPlayerAnimation(animationId, animationTime, animationIdOld, animationTimeOld, 0); + ImGui::InputScalar(" ", ImGuiDataType_U32, &animationId); ImGui::SameLine(); - if (ImGui::BeginCombo(" ", cRaidenFlags[cRaidenType], ImGuiComboFlags_NoArrowButton | ImGuiComboFlags_HeightRegular)) - { - for (int i = 0; i < IM_ARRAYSIZE(cRaidenFlags); i++) { - bool is_selected = (cRaidenType == i); - if (ImGui::Selectable(cRaidenFlags[i], is_selected)) { - cRaidenType = i; - } - if (is_selected) { - ImGui::SetItemDefaultFocus(); - } - } - ImGui::EndCombo(); - } + ImGui::Indent(155); + ImGui::InputScalar(" ", ImGuiDataType_U32, &animationTime); + ImGui::Unindent(155); - if (ImGui::Button("RENDER", ImVec2(150, 20))) - RedTrainer::setRender(renderType); + ImGui::InputScalar(" ", ImGuiDataType_U32, &animationIdOld); + ImGui::SameLine(); + ImGui::Indent(155); + ImGui::InputScalar(" ", ImGuiDataType_U32, &animationTimeOld); + ImGui::Unindent(155); + + if (ImGui::Button("PRINT TEST", ImVec2(150, 20))) + RedTrainer::printMessage(messageId, messageNum, messagePrint, messagePosition, messageChar); + ImGui::InputScalar(" ", ImGuiDataType_U32, &messageId); + ImGui::SameLine(); + ImGui::Indent(155); + ImGui::InputScalar(" ", ImGuiDataType_S32, &messageNum); /// MSG Display Time + ImGui::Unindent(155); + + ImGui::InputScalar(" ", ImGuiDataType_S32, &messagePrint); + ImGui::SameLine(); + ImGui::Indent(155); + ImGui::InputScalar(" ", ImGuiDataType_S32, &messagePosition); + ImGui::Unindent(155); + + if (ImGui::Button("SET BGM", ImVec2(150, 20))) + RedTrainer::setBgm(bgmPtr); ImGui::SameLine(); - ImGui::InputScalar(" ", ImGuiDataType_U32, &renderType, NULL, NULL, "%X"); + ImGui::Indent(155); + ImGui::InputScalar(" ", ImGuiDataType_U32, &bgmPtr, NULL, NULL, "%X"); + ImGui::Unindent(155); + + if (ImGui::Button("SET BGM STRING", ImVec2(150, 20))) + RedTrainer::setBgm(bgmChar); + ImGui::SameLine(); + ImGui::Indent(155); + ImGui::InputText(" ", bgmChar, sizeof(bgmChar)); //Mission name + ImGui::Unindent(155); ImGui::End(); renderStyle(0); @@ -852,6 +883,28 @@ void RtGui::otherWindow() ImGui::EndCombo(); } + if (ImGui::Button("SET FLAG", ImVec2(150, 20))) + RedTrainer::setFlag(cRaidenType); + ImGui::SameLine(); + if (ImGui::BeginCombo(" ", cRaidenFlags[cRaidenType], ImGuiComboFlags_NoArrowButton | ImGuiComboFlags_HeightRegular)) + { + for (int i = 0; i < IM_ARRAYSIZE(cRaidenFlags); i++) { + bool is_selected = (cRaidenType == i); + if (ImGui::Selectable(cRaidenFlags[i], is_selected)) { + cRaidenType = i; + } + if (is_selected) { + ImGui::SetItemDefaultFocus(); + } + } + ImGui::EndCombo(); + } + + if (ImGui::Button("RENDER", ImVec2(150, 20))) + RedTrainer::setRender(renderType); + ImGui::SameLine(); + ImGui::InputScalar(" ", ImGuiDataType_U32, &renderType, NULL, NULL, "%X"); + ImGui::End(); renderStyle(0); } diff --git a/src/trainerGui/trainerGui.h b/src/trainerGui/trainerGui.h index 7b3ad35..d6fab66 100644 --- a/src/trainerGui/trainerGui.h +++ b/src/trainerGui/trainerGui.h @@ -1,6 +1,7 @@ namespace RtGui { - extern bool bFly; + extern bool bFly, + bTestWindow; void mainWindow(); @@ -14,7 +15,7 @@ namespace RtGui { void missionWindow(); - void raidenFlagsWindow(); + void testWindow(); void otherWindow();