Skip to content

Commit

Permalink
Merge indev into master. (#44)
Browse files Browse the repository at this point in the history
* Added separate function to resolve relative addresses in address.h

* Added new patterns to the print function.

* Updated IsFlagSet hooks.

* Cleaned up code to properly mask off Dev and Cheat flags.
* Added separate define from _DEBUG so you can define it in release builds for people without C++ Debug Restributeables.

* Removed un-used define in hooks.h

* Fixed potential crashes in r5net and added debug prints.

* Potential crashes were when in certain post functions the returned status wasn't 200.

* Changed map-select drop down menu, now it displays 'Map Name + Season' instead of file-name. (#41)

* Host Server shows normal map names

* Changed a few stuff...

* redid some stuff that isn't crucial

* Update CCompanion.cpp

* Update CCompanion.cpp

* Updated mapname displaying.

* Moved "ServerMap" as a static object into CCompanion::HostServerSection().

Co-authored-by: IcePixelx <41352111+PixieCore@users.noreply.github.com>

* prevent squirrel compiler errors from killing game process (#43)

* Read description for all changes.

* Added ability to register custom ConVar.
* Added 2 custom ConVars to open the CGameConsole and CCompanion Windows.
* Changed ResolveRelativeAddress.
* Added Config System for the Gui.
* Added ImGui::Hotkey.
* Added the ability to change 2 hotkeys for opening the window for CGameConsole and CCompanion.
* Changed pattern for Squirrel_CompilerError to use a String.
* Added IMemAlloc::AllocWrapper to patterns.h

* Changes in description.

* Added icon to launcher.exe
* Launcher.exe gets remnamed to Run R5 Reloaded.exe in launcher release compilation configuration.
* Extended argument buffer for starting the game in launcher.exe.
* Added exception printing if in the custom ConVars an invalid value gets passed.

* Wrong return.

* Added shortcut with launch params.

* Fixed prints.

Co-authored-by: Marcii0 <58266292+Marcii0@users.noreply.github.com>
Co-authored-by: BobTheBob <32057864+BobTheBob9@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 19, 2021
1 parent 3c64168 commit 7bb4fd6
Show file tree
Hide file tree
Showing 28 changed files with 908 additions and 118 deletions.
1 change: 1 addition & 0 deletions external/imgui/include/imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ namespace ImGui
IMGUI_API bool InputDouble(const char* label, double* v, double step = 0.0, double step_fast = 0.0, const char* format = "%.6f", ImGuiInputTextFlags flags = 0);
IMGUI_API bool InputScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_step = NULL, const void* p_step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags flags = 0);
IMGUI_API bool InputScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_step = NULL, const void* p_step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags flags = 0);
IMGUI_API bool Hotkey(const char* label, int* key, const ImVec2& size);

// Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little color square that can be left-clicked to open a picker, and right-clicked to open an option menu.)
// - Note that in C++ a 'float v[X]' function argument is the _same_ as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible.
Expand Down
361 changes: 361 additions & 0 deletions external/imgui/src/imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8048,4 +8048,365 @@ void ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb,
}


const char* const KeyNames[] =
{
"Null",
"Mouse1",
"Mouse2",
"Cancel",
"Mouse3",
"Mouse4",
"Mouse5",
"Undefined",
"Back",
"Tab",
"Reserved",
"Reserved",
"Clear",
"Return",
"Undefined",
"Undefined",
"Shift",
"Control",
"Menu",
"Pause",
"Capital",
"Kana",
"Ime On",
"Junja",
"Final",
"Kanji",
"Ime Off",
"Escape",
"Convert",
"Nonconvert",
"Accept",
"Modechange",
"Space",
"Prior",
"Next",
"End",
"Home",
"Left",
"Up",
"Right",
"Down",
"Select",
"Print",
"Execute",
"Snapshot",
"Insert",
"Delete",
"Help",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"Lwin",
"Rwin",
"Apps",
"Unknown",
"Sleep",
"Numpad0",
"Numpad1",
"Numpad2",
"Numpad3",
"Numpad4",
"Numpad5",
"Numpad6",
"Numpad7",
"Numpad8",
"Numpad9",
"Multiply",
"Add",
"Separator",
"Subtract",
"Decimal",
"Divide",
"F1",
"F2",
"F3",
"F4",
"F5",
"F6",
"F7",
"F8",
"F9",
"F10",
"F11",
"F12",
"F13",
"F14",
"F15",
"F16",
"F17",
"F18",
"F19",
"F20",
"F21",
"F22",
"F23",
"F24",
"Unassigned",
"Unassigned",
"Unassigned",
"Unassigned",
"Unassigned",
"Unassigned",
"Unassigned",
"Unassigned",
"Numlock",
"Scroll",
"Oem_nec_equal",
"Oem_fj_masshou",
"Oem_fj_touroku",
"Oem_fj_loya",
"Oem_fj_roya",
"Unknown",
"Unknown",
"Unknown",
"Unknown",
"Unknown",
"Unknown",
"Unknown",
"Unknown",
"Unknown",
"Lshift",
"Rshift",
"Lcontrol",
"Rcontrol",
"Lmenu",
"Rmenu",
"Browser Back",
"Browser Stop",
"Browser Refresh",
"Browser Search",
"Browser Favorite",
"Browser Home",
"Volume Mute",
"Volume Down",
"Volume Up",
"Next Track",
"Previous Track",
"Media Stop",
"Play/Pause",
"Mail",
"Media",
"App1",
"App2",
"Reserved",
"Reserved",
"Reserved",
":;",
"+",
",",
"-",
".",
"?",
"~",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined",
"Undefined"
};

bool ImGui::Hotkey(const char* label, int* key, const ImVec2& ssize)
{
ImGuiWindow* window = ImGui::GetCurrentWindow();
if (window->SkipItems)
return false;

ImGuiContext& g = *GImGui;
ImGuiIO& io = g.IO;
const ImGuiStyle& style = g.Style;

float backupPaddingY = style.FramePadding.y;
g.Style.FramePadding.y = 0.0f;

const ImGuiID id = window->GetID(label);
const ImVec2 labelSize = ImGui::CalcTextSize(label, NULL, true);
const ImVec2 size = ImGui::CalcItemSize(ssize, ImGui::CalcItemWidth(), labelSize.y + style.FramePadding.y * 2.0f);

const ImRect frameBB(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, labelSize.y + style.FramePadding.y));
const ImRect total_bb(frameBB.Min, frameBB.Max + ImVec2(labelSize.x > 0.0f ? style.ItemInnerSpacing.x + labelSize.x : 0.0f, 0.0f));

ImGui::ItemSize(total_bb, style.FramePadding.y);
if (!ImGui::ItemAdd(total_bb, id))
{
g.Style.FramePadding.y = backupPaddingY;
return false;
}

const bool requestedFocus = ImGui::FocusableItemRegister(window, id);
const bool isHovered = ImGui::ItemHoverable(frameBB, id);

if (isHovered) {
ImGui::SetHoveredID(id);
g.MouseCursor = ImGuiMouseCursor_TextInput;
}

const bool didClick = isHovered && io.MouseClicked[0];

if (requestedFocus || didClick)
{
if (g.ActiveId != id)
{
memset(io.MouseDown, 0, sizeof(io.MouseDown));
memset(io.KeysDown, 0, sizeof(io.KeysDown));
*key = 0;
}
ImGui::SetActiveID(id, window);
ImGui::FocusWindow(window);
}
else if (io.MouseClicked[0])
{
if (g.ActiveId == id)
{
ImGui::ClearActiveID();
}
}

bool didValueChange = false;
int kkey = *key;

if (g.ActiveId == id)
{
for (auto i = 0x1; i <= 0xA5; i++)
{
if (io.KeysDown[i])
{
kkey = i;
didValueChange = true;
ImGui::ClearActiveID();
}
}

if (IsKeyPressedMap(ImGuiKey_Escape))
{
*key = NULL;
ImGui::ClearActiveID();
}
else
{
*key = kkey;
}
}

char displayBuf[24] = "None";

if (*key != 0 && g.ActiveId != id)
{
strcpy_s(displayBuf, KeyNames[*key]);
}
else if (g.ActiveId == id)
{
strcpy_s(displayBuf, "Press key");
}

const ImRect clip_rect(frameBB.Min.x, frameBB.Min.y, frameBB.Min.x + size.x, frameBB.Min.y + size.y);
ImGui::RenderTextClipped(frameBB.Min + style.FramePadding, frameBB.Max - style.FramePadding, displayBuf, NULL, NULL, style.ButtonTextAlign, &clip_rect);

g.Style.FramePadding.y = backupPaddingY;

return didValueChange;
}

#endif // #ifndef IMGUI_DISABLE
6 changes: 4 additions & 2 deletions r5dev/include/gameclasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,13 @@ class ConVar
const char* m_pzsCurrentValue; //0x0058
__int64 m_iStringLength; //0x0060
float m_flValue; //0x0068
__int64 m_iValue; //0x006C
int m_iValue; //0x006C
bool m_bHasMin; //0x0070
float m_flMinValue; //0x0074
bool m_bHasMax; //0x0078
float m_flMaxValue; //0x007C
}; //Size: 0x0080
char pad_0080[32]; //0x0080
}; //Size: 0x00A0

class CCVarIteratorInternal // Fully reversed table, just look at the virtual function table and rename the function.
{
Expand Down Expand Up @@ -368,6 +369,7 @@ namespace GameGlobals
extern CInputSystem* InputSystem;
extern CCVar* Cvar;

ConVar* CreateCustomConVar(const char* name, const char* defaultValue, int flags, const char* helpString, bool bMin, float fMin, bool bMax, float fMax, void* callback, void* unk);
void InitGameGlobals();
extern bool IsInitialized;
}
Loading

0 comments on commit 7bb4fd6

Please # to comment.