Skip to content

Commit

Permalink
Back to public view, this is going to be the last update for a while.
Browse files Browse the repository at this point in the history
  • Loading branch information
berkayylmao committed Mar 6, 2018
1 parent 2fabeaa commit 2ee9ba8
Show file tree
Hide file tree
Showing 26 changed files with 205 additions and 233 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,7 @@ ASALocalRun/
# Executables
*.exe
*.out
*.app
*.app

# RockportEd InGameMenu Debug file
RockportEd/Extensions/InGame Menu/Items/Debug.hpp
66 changes: 0 additions & 66 deletions RockportEd/Debug.hpp

This file was deleted.

11 changes: 7 additions & 4 deletions RockportEd/Extensions/DInput8/DI8Extension.cpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
#include "stdafx.h"
#include "Extensions\Extensions.h"
#include "DI8Extension.h"
#include "Helpers\WndProc\WndProcHook.h"

namespace Extensions {
namespace DI8 {
void WINAPI getDeviceState_Keyboard(HINSTANCE hInstance, DWORD cbData, LPVOID lpvData) {
if (cbData == 256) {
if (GameInternals::Data::Variables::isGameWindowInactive() || imguiIO->WantTextInput/* || imguiIO->WantCaptureKeyboard*/) {
if (GameInternals::Data::Variables::isGameWindowInactive() || imguiIO->WantTextInput
/*|| imguiIO->WantCaptureKeyboard*/ || GetForegroundWindow() != Helpers::WndProcHook::windowHandle) {
ZeroMemory(lpvData, 256);
return;
}
}
}
void WINAPI getDeviceState_Mouse(HINSTANCE hInstance, DWORD cbData, LPVOID lpvData) {
DIMOUSESTATE* mouseState = (DIMOUSESTATE*)lpvData;
if (GameInternals::Data::Variables::isGameWindowInactive() || imguiIO->WantCaptureMouse) {
ZeroMemory(mouseState->rgbButtons, 4);
if (GameInternals::Data::Variables::isGameWindowInactive() || imguiIO->WantCaptureMouse
|| GetForegroundWindow() != Helpers::WndProcHook::windowHandle) {
ZeroMemory(mouseState->rgbButtons, sizeof(mouseState->rgbButtons));
}
}

void Init() {
*GameInternals::Data::Variables::gameWindowInactive = true;
MirrorHook::DI8::AddExtension(
MirrorHook::DI8::DI8Device::Keyboard,
MirrorHook::DI8::DI8Extension::GetDeviceState,
Expand Down
13 changes: 8 additions & 5 deletions RockportEd/Extensions/InGame Menu/InGameMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace Extensions {

void WINAPI beginScene(LPDIRECT3DDEVICE9 pDevice) {
if (!isImguiInitialized) {
ImGui_ImplDX9_Init(Hooks::WndProc::windowHandle, pDevice);
ImGui_ImplDX9_Init(Helpers::WndProcHook::windowHandle, pDevice);
imguiIO->Fonts->AddFontFromMemoryCompressedTTF(RobotoMedium::RobotoMedium_compressed_data, RobotoMedium::RobotoMedium_compressed_size, 14.0f);
imguiIO->FontDefault = NULL;
imguiIO->IniFilename = NULL;
Expand All @@ -68,15 +68,13 @@ namespace Extensions {
ImGui::Begin("##Huh", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs);
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "RockportEd debug build");
ImGui::Bullet(); ImGui::TextWrapped("Menu input <-> game input RETURN(Enter) KeyUp is broken.");
//ImGui::Bullet(); ImGui::TextWrapped("Lighting Editor only works on some save games and is unstable. TODO: Update pointer to a vtable*.");
ImGui::Bullet(); ImGui::TextWrapped("For KuruHS, not meant for any other use.");
ImGui::End();

if (isMainWindowVisible) {
imguiIO->MouseDrawCursor = imguiIO->WantCaptureMouse;
showUserGuide();

ImGui::SetNextWindowPos(ImVec2(10.0f, 5.0f), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(5.0f, 5.0f), ImGuiCond_Once);
if (ImGui::Begin("RockportEd", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
for (auto item : items) {
if (item->hasLoadedData) {
Expand Down Expand Up @@ -109,6 +107,11 @@ namespace Extensions {

LRESULT CALLBACK wndProcExtension(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
if (isImguiInitialized) {
if (uMsg == WM_QUIT) {
ImGui_ImplDX9_Shutdown();
return FALSE;
}

if (isMainWindowVisible)
ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam);

Expand Down Expand Up @@ -139,7 +142,7 @@ namespace Extensions {
MirrorHook::D3D9::AddExtension(MirrorHook::D3D9::D3D9Extension::BeforeReset, &beforeReset);
MirrorHook::D3D9::AddExtension(MirrorHook::D3D9::D3D9Extension::AfterReset, &afterReset);

Hooks::WndProc::addExtension(&wndProcExtension);
Helpers::WndProcHook::addExtension(&wndProcExtension);
}
}
}
42 changes: 20 additions & 22 deletions RockportEd/Extensions/InGame Menu/Items/CameraEditor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Extensions {
if (oldCameraIndex != *pActiveCameraIndex
|| ((oldCameraIndex == *pActiveCameraIndex) && (!pActiveCameraInfo))) {
if (GameInternals::Gameplay::Camera::getActiveCameraInfo(pActiveCameraInfo)) {
std::string activeCameraName = pActiveCameraInfo->collectionName;
std::string activeCameraName = pActiveCameraInfo->CollectionName;
auto iter = Settings::settingsType.camPresets.find(activeCameraName);
if (iter != Settings::settingsType.camPresets.end()) {
if (!hasAlreadyLoadedSettings[activeCameraName]) {
Expand All @@ -44,78 +44,76 @@ namespace Extensions {

ImGui::Checkbox("Camera Editor", &isEnabled);
if (isEnabled) {
ImGui::SetNextWindowSize(ImVec2(240.0f, 400.0f), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(10.0f * 2 + 200.0f, 5.0f), ImGuiCond_Once);
if (ImGui::Begin("Camera Editor", &isEnabled)) {
ImGui::PushItemWidth(-1.0f);
if (pActiveCameraIndex) {
ImGui::TextWrapped("Do not change the camera index while not in gameplay! (Cutsecenes, safehouse, etc.)");
ImGui::TextWrapped("Camera Index"); ImGui::SameLine();
ImGui::SliderInt("##CameraIndex", pActiveCameraIndex, 0, 6);
if (pActiveCameraInfo) {
ImGui::TextWrapped("Camera Name: %s", pActiveCameraInfo->collectionName);
ImGui::TextWrapped("Camera Name: %s", pActiveCameraInfo->CollectionName);

ImGui::Checkbox("Advanced options", &showAdvancedOptions);
ImGui::SameLine(); ImGui::VerticalSeparator(); ImGui::SameLine();
if (ImGui::Button("Save Preset")) {
Settings::settingsType.camPresets[std::string(pActiveCameraInfo->collectionName)] = pActiveCameraInfo;
Settings::settingsType.camPresets[std::string(pActiveCameraInfo->CollectionName)] = pActiveCameraInfo;
Settings::saveSettings();
}

ImGui::TextWrapped("Stiffness");
ImGui::SliderFloat("##CameraStiffness", &pActiveCameraInfo->stiffness[0], 0.0f, 1.0f);
ImGui::SliderFloat("##CameraStiffness", &pActiveCameraInfo->Stiffness[0], 0.0f, 1.0f);
if (showAdvancedOptions) {
ImGui::Text("STIFFNESS[1]"); ImGui::SameLine();
ImGui::SliderFloat("##CameraStiffness_1", &pActiveCameraInfo->stiffness[1], 0.0f, 1.0f);
ImGui::SliderFloat("##CameraStiffness_1", &pActiveCameraInfo->Stiffness[1], 0.0f, 1.0f);
}

ImGui::TextWrapped("Horizontal angle");
ImGui::SliderFloat("##CameraHorizontalAngle", &pActiveCameraInfo->angle[0], -45.0f, 45.0f, "%.3f deg");
ImGui::SliderFloat("##CameraHorizontalAngle", &pActiveCameraInfo->Angle[0], -45.0f, 45.0f, "%.3f deg");
if (showAdvancedOptions) {
ImGui::Text("ANGLE[1]"); ImGui::SameLine();
ImGui::SliderFloat("##CameraHorizontalAngle_1", &pActiveCameraInfo->angle[1], -45.0f, 45.0f, "%.3f deg");
ImGui::SliderFloat("##CameraHorizontalAngle_1", &pActiveCameraInfo->Angle[1], -45.0f, 45.0f, "%.3f deg");
}

ImGui::TextWrapped("Distance");
ImGui::SliderFloat("##CameraDistance", &pActiveCameraInfo->lag[0], -100.0f, 100.0f);
ImGui::SliderFloat("##CameraDistance", &pActiveCameraInfo->Lag[0], -100.0f, 100.0f);
if (showAdvancedOptions) {
ImGui::Text("LAG[1]"); ImGui::SameLine();
ImGui::SliderFloat("##CameraDistance_1", &pActiveCameraInfo->lag[1], -100.0f, 100.0f);
ImGui::SliderFloat("##CameraDistance_1", &pActiveCameraInfo->Lag[1], -100.0f, 100.0f);
}

ImGui::TextWrapped("FOV");
ImGui::SliderFloat("##CameraFOV", &pActiveCameraInfo->fov[0], 25.0f, 135.0f);
ImGui::SliderFloat("##CameraFOV", &pActiveCameraInfo->FOV[0], 25.0f, 135.0f);
if (showAdvancedOptions) {
ImGui::Text("FOV[1]"); ImGui::SameLine();
ImGui::SliderFloat("##CameraFOV_1", &pActiveCameraInfo->fov[1], 25.0f, 135.0f);
ImGui::SliderFloat("##CameraFOV_1", &pActiveCameraInfo->FOV[1], 25.0f, 135.0f);
}

ImGui::TextWrapped("Height");
ImGui::SliderFloat("##CameraHeight", &pActiveCameraInfo->height[0], 0.0f, 100.0f);
ImGui::SliderFloat("##CameraHeight", &pActiveCameraInfo->Height[0], 0.0f, 100.0f);
if (showAdvancedOptions) {
ImGui::Text("HEIGHT[1]"); ImGui::SameLine();
ImGui::SliderFloat("##CameraHeight_1", &pActiveCameraInfo->height[1], 0.0f, 100.0f);
ImGui::SliderFloat("##CameraHeight_1", &pActiveCameraInfo->Height[1], 0.0f, 100.0f);
}

ImGui::TextWrapped("Vertical angle");
ImGui::SliderFloat("##CameraLateOffset", &pActiveCameraInfo->lateOffset[0], -89.0f, 89.0f, "%.3f deg");
ImGui::SliderFloat("##CameraLateOffset", &pActiveCameraInfo->LateOffset[0], -89.0f, 89.0f, "%.3f deg");
if (showAdvancedOptions) {
ImGui::Text("LATEOFFSET[1]"); ImGui::SameLine();
ImGui::SliderFloat("##CameraLateOffset_1", &pActiveCameraInfo->lateOffset[1], -89.0f, 89.0f);
ImGui::SliderFloat("##CameraLateOffset_1", &pActiveCameraInfo->LateOffset[1], -89.0f, 89.0f);
}

ImGui::Checkbox("Tilting", &pActiveCameraInfo->tilting[0]);
ImGui::Checkbox("Tilting", &pActiveCameraInfo->Tilting[0]);
if (showAdvancedOptions) {
ImGui::Checkbox("TILTING[1]", &pActiveCameraInfo->tilting[1]);
ImGui::Checkbox("TILTING[1]", &pActiveCameraInfo->Tilting[1]);
}

ImGui::Checkbox("Selectable", &pActiveCameraInfo->selectable[0]);
ImGui::Checkbox("Selectable", &pActiveCameraInfo->Selectable[0]);
if (showAdvancedOptions) {
ImGui::Checkbox("SELECTABLE[1]", &pActiveCameraInfo->selectable[1]);
ImGui::Checkbox("SELECTABLE[1]", &pActiveCameraInfo->Selectable[1]);
}
} else {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f));
ImGui::TextWrapped("CameraInfo not yet initialized by the game.");
ImGui::TextWrapped("No active CameraInfo was found.");
ImGui::PopStyleColor();
}
} else {
Expand Down
18 changes: 9 additions & 9 deletions RockportEd/Extensions/InGame Menu/Items/CarConfigurator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ namespace Extensions {
ImGui::TextWrapped("Object Data");
ImGui::Indent(5.0f);
{
ImGui::SliderFloat("Gravity", &carObjectData->gravity, 0.1f, 3500.0f);
ImGui::SliderFloat("Grip", &carObjectData->grip, 0.0001f, 0.003f, "%.6f");
ImGui::SliderFloat("Gravity", &carObjectData->Gravity, 0.1f, 3500.0f);
ImGui::SliderFloat("Grip", &carObjectData->Grip, 0.0001f, 0.003f, "%.6f");
}
ImGui::Unindent(5.0f);

ImGui::TextWrapped("Physics Tuning");
ImGui::Indent(5.0f);
{
ImGui::SliderFloat("Steering", &carPhysicsTuning.steering, -10.0f, 10.0f);
ImGui::SliderFloat("Handling", &carPhysicsTuning.handling, -10.0f, 10.0f);
ImGui::SliderFloat("Brakes", &carPhysicsTuning.brakes, -10.0f, 10.0f);
ImGui::SliderFloat("Ride Height", &carPhysicsTuning.rideHeight, -10.0f, 10.0f);
ImGui::SliderFloat("Aerodynamics", &carPhysicsTuning.aerodynamics, -10.0f, 10.0f);
ImGui::SliderFloat("NOS", &carPhysicsTuning.nos, -10.0f, 10.0f);
ImGui::SliderFloat("Turbo", &carPhysicsTuning.turbo, -10.0f, 10.0f);
ImGui::SliderFloat("Steering", &carPhysicsTuning.Steering, -10.0f, 10.0f);
ImGui::SliderFloat("Handling", &carPhysicsTuning.Handling, -10.0f, 10.0f);
ImGui::SliderFloat("Brakes", &carPhysicsTuning.Brakes, -10.0f, 10.0f);
ImGui::SliderFloat("Ride Height", &carPhysicsTuning.RideHeight, -10.0f, 10.0f);
ImGui::SliderFloat("Aerodynamics", &carPhysicsTuning.Aerodynamics, -10.0f, 10.0f);
ImGui::SliderFloat("NOS", &carPhysicsTuning.NOS, -10.0f, 10.0f);
ImGui::SliderFloat("Turbo", &carPhysicsTuning.Turbo, -10.0f, 10.0f);
if (ImGui::Button("Apply") || autoUpdate) {
GameInternals::Gameplay::Player::Car::setCarPhysicsTuning(&carPhysicsTuning);
if (!autoUpdate)
Expand Down
4 changes: 1 addition & 3 deletions RockportEd/Extensions/InGame Menu/Items/GameplayOptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace Extensions {
const virtual void displayMenu() override {
ImGui::Checkbox("Gameplay Options", &isEnabled);
if (isEnabled) {
ImGui::SetNextWindowPos(ImVec2(10.0f, 5.0f * 2 + 100.0f), ImGuiCond_Once);
if (ImGui::Begin("Gameplay Options", &isEnabled)) {
ImGui::PushItemWidth(-1.0f);

Expand All @@ -25,8 +24,7 @@ namespace Extensions {
trafficRefreshInterval = GameInternals::Gameplay::Variables::getTrafficRefreshIntervalAsPointer();
if (trafficRefreshInterval) {
ImGui::SliderFloat("##TrafficRefreshInterval", trafficRefreshInterval, 1.0f, 640.0f);
}
else {
} else {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f));
ImGui::TextWrapped("Traffic AI not yet initialized by the game.");
ImGui::PopStyleColor();
Expand Down
2 changes: 0 additions & 2 deletions RockportEd/Extensions/InGame Menu/Items/LightingEditor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ namespace Extensions {
curLighting_pt1 = Memory::readPointer(0x5B392C, 1, 0xC4);
curLighting_pt2 = Memory::readPointer(0x5B392C, 1, 0xC8);
if (curLighting_pt1 && curLighting_pt2) {
ImGui::SetNextWindowSize(ImVec2(280.0f, 395.0f), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(10.0f * 3 + 200.0f + 240.0f, 5.0f), ImGuiCond_Once);
if (ImGui::Begin("Time of Day Lighting Editor", &isEnabled)) {
if (!todInstance)
todInstance = *(TimeOfDayLighting**)(*curLighting_pt1 + 0x18);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "stdafx.h"
#include "Extensions\InGame Menu\InGameMenu.h"
#include "Debug.hpp"
//#include "Debug.hpp"
#include "CarConfigurator.hpp"
#include "CameraEditor.hpp"
#include "GameplayOptions.hpp"
Expand Down
15 changes: 6 additions & 9 deletions RockportEd/Extensions/WndProc/FixAnnoyances.hpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
#pragma once
#include "stdafx.h"
#include "Extensions\Extensions.h"
// Helpers
#include "Helpers\WndProc\WndProcHook.h"

namespace Extensions {
namespace WndProc {
namespace FixAnnoyances {
// TODO: Expose on SettingsType
static bool disableAltMenu = true;
static bool disableStopOnFocusLoss = false;
static bool disableWindowsMouse = true;

static LRESULT CALLBACK wndProcExtension(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_SYSCOMMAND:
if ((wParam & 0xFFF0) == SC_KEYMENU && disableAltMenu) {
if ((wParam & 0xFFF0) == SC_KEYMENU && Settings::settingsType.preferences.WindowedModePreferences.DisableAltMenu) {
return TRUE;
}
break;
case WM_ACTIVATEAPP:
if (wParam == FALSE && disableStopOnFocusLoss) {
if (wParam == FALSE && !Settings::settingsType.preferences.PauseGameplayOnOnFocusLoss) {
return TRUE;
}
break;
case WM_SETCURSOR:
if (LOWORD(lParam) == HTCLIENT && disableWindowsMouse) {
if (LOWORD(lParam) == HTCLIENT && Settings::settingsType.preferences.WindowedModePreferences.DisableWindowsMouse) {
SetCursor(NULL);
return TRUE;
}
Expand All @@ -33,7 +30,7 @@ namespace Extensions {
}

static void Init() {
Hooks::WndProc::addExtension(&wndProcExtension);
Helpers::WndProcHook::addExtension(&wndProcExtension);
}
}
}
Expand Down
Loading

0 comments on commit 2ee9ba8

Please sign in to comment.