ScaleComponent.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #include "ScaleComponent.h"
  2. #include <iostream>
  3. #include <Windows.h>
  4. #include "../Constants.h"
  5. #include <stdio.h>
  6. #include "../framework.h"
  7. #include <chrono>
  8. #include <thread>
  9. #include <tchar.h>
  10. #include <GL/freeglut.h>
  11. namespace TLAC::Components
  12. {
  13. ScaleComponent::ScaleComponent()
  14. {
  15. }
  16. ScaleComponent::~ScaleComponent()
  17. {
  18. }
  19. const char* ScaleComponent::GetDisplayName()
  20. {
  21. return "scale_component";
  22. }
  23. void ScaleComponent::Initialize(ComponentsManager*)
  24. {
  25. {
  26. DWORD oldProtect, bck;
  27. VirtualProtect((BYTE*)0x00000001404ACD24, 7, PAGE_EXECUTE_READWRITE, &oldProtect);
  28. *((byte*)0x00000001404ACD24 + 0) = 0x44;
  29. *((byte*)0x00000001404ACD24 + 1) = 0x8B;
  30. *((byte*)0x00000001404ACD24 + 2) = 0x0D;
  31. *((byte*)0x00000001404ACD24 + 3) = 0xD1;
  32. *((byte*)0x00000001404ACD24 + 4) = 0x08;
  33. *((byte*)0x00000001404ACD24 + 5) = 0xD0;
  34. *((byte*)0x00000001404ACD24 + 6) = 0x00;
  35. VirtualProtect((BYTE*)0x00000001404ACD24, 7, oldProtect, &bck);
  36. }
  37. {
  38. DWORD oldProtect, bck;
  39. VirtualProtect((BYTE*)0x00000001404ACD2B, 7, PAGE_EXECUTE_READWRITE, &oldProtect);
  40. *((byte*)0x00000001404ACD2B + 0) = 0x44;
  41. *((byte*)0x00000001404ACD2B + 1) = 0x8B;
  42. *((byte*)0x00000001404ACD2B + 2) = 0x05;
  43. *((byte*)0x00000001404ACD2B + 3) = 0xC6;
  44. *((byte*)0x00000001404ACD2B + 4) = 0x08;
  45. *((byte*)0x00000001404ACD2B + 5) = 0xD0;
  46. *((byte*)0x00000001404ACD2B + 6) = 0x00;
  47. VirtualProtect((BYTE*)0x00000001404ACD2B, 7, oldProtect, &bck);
  48. }
  49. {
  50. DWORD oldProtect, bck;
  51. VirtualProtect((BYTE*)0x00000001405030A0, 6, PAGE_EXECUTE_READWRITE, &oldProtect);
  52. *((byte*)0x00000001405030A0 + 0) = 0x90;
  53. *((byte*)0x00000001405030A0 + 1) = 0x90;
  54. *((byte*)0x00000001405030A0 + 2) = 0x90;
  55. *((byte*)0x00000001405030A0 + 3) = 0x90;
  56. *((byte*)0x00000001405030A0 + 4) = 0x90;
  57. *((byte*)0x00000001405030A0 + 5) = 0x90;
  58. VirtualProtect((BYTE*)0x00000001404ACD2B, 6, oldProtect, &bck);
  59. }
  60. }
  61. void ScaleComponent::Update()
  62. {
  63. uiAspectRatio = (float*)UI_ASPECT_RATIO;
  64. uiWidth = (float*)UI_WIDTH_ADDRESS;
  65. uiHeight = (float*)UI_HEIGHT_ADDRESS;
  66. fb1Height = (int*)FB1_HEIGHT_ADDRESS;
  67. fb1Width = (int*)FB1_WIDTH_ADDRESS;
  68. //fb2Height = (int*)FB2_HEIGHT_ADDRESS;
  69. //fb2Width = (int*)FB2_WIDTH_ADDRESS;
  70. fbAspectRatio = (double*)FB_ASPECT_RATIO;
  71. RECT hWindow;
  72. GetClientRect(TLAC::framework::DivaWindowHandle, &hWindow);
  73. *uiAspectRatio = (float)(hWindow.right - hWindow.left) / (float)(hWindow.bottom - hWindow.top);
  74. *fbAspectRatio = (double)(hWindow.right - hWindow.left) / (double)(hWindow.bottom - hWindow.top);
  75. *uiWidth = hWindow.right - hWindow.left;
  76. *uiHeight = hWindow.bottom - hWindow.top;
  77. *fb1Width = hWindow.right - hWindow.left;
  78. *fb1Height = hWindow.bottom - hWindow.top;
  79. //*fb2Width = hWindow.right - hWindow.left;
  80. //*fb2Height = hWindow.bottom - hWindow.top;
  81. *((int*)0x00000001411AD608) = 0;
  82. *((int*)0x0000000140EDA8E4) = *(int*)0x0000000140EDA8BC;
  83. *((int*)0x0000000140EDA8E8) = *(int*)0x0000000140EDA8C0;
  84. *(float*)0x00000001411A1900 = 0;
  85. *(float*)0x00000001411A1904 = (float)*(int*)0x0000000140EDA8BC;
  86. *(float*)0x00000001411A1908 = (float)*(int*)0x0000000140EDA8C0;
  87. //*((int*)0x00000001411AD5F8) = hWindow.right - hWindow.left;
  88. //*((int*)0x00000001411AD5FC) = hWindow.bottom - hWindow.top;
  89. //*((int*)0x00000001411ABB48) = hWindow.right - hWindow.left;
  90. //*((int*)0x00000001411ABB4C) = hWindow.bottom - hWindow.top;
  91. //*((int*)0x00000001411ABB5C) = (int)(*((int*)0x00000001411ABB54) * ((float)8 / (float)9)); //wtf??
  92. }
  93. void ScaleComponent::UpdateInput()
  94. {
  95. return;
  96. }
  97. }