Refactored code, fixes
This commit is contained in:
parent
d506387a42
commit
68e63a7ccb
1
.gitignore
vendored
1
.gitignore
vendored
@ -43,3 +43,4 @@ moonloader/lib/cheat-menu/json/config.json
|
|||||||
/CheatMenu.VC.db
|
/CheatMenu.VC.db
|
||||||
.vs/CheatMenu/v14/.suo
|
.vs/CheatMenu/v14/.suo
|
||||||
ipch/CHEATMENU.VCXPROJ-daebb660/CHEATMENU-7e055069.ipch
|
ipch/CHEATMENU.VCXPROJ-daebb660/CHEATMENU-7e055069.ipch
|
||||||
|
/ipch/CHEATMENU.VCXPROJ-daebb660/CHEATMENU-ac659b63.ipch
|
||||||
|
@ -58,9 +58,6 @@ CheatMenu::CheatMenu()
|
|||||||
|
|
||||||
if (Globals::init_done && !FrontEndMenuManager.m_bMenuActive && CTimer::m_snTimeInMilliseconds - Globals::last_key_timer > 250)
|
if (Globals::init_done && !FrontEndMenuManager.m_bMenuActive && CTimer::m_snTimeInMilliseconds - Globals::last_key_timer > 250)
|
||||||
{
|
{
|
||||||
CPlayerPed* player = FindPlayerPed();
|
|
||||||
CPad *pad = player->GetPadFromPlayer();
|
|
||||||
|
|
||||||
if (Ui::HotKeyPressed(hotkey::menu_open))
|
if (Ui::HotKeyPressed(hotkey::menu_open))
|
||||||
{
|
{
|
||||||
Globals::show_menu = !Globals::show_menu;
|
Globals::show_menu = !Globals::show_menu;
|
||||||
@ -77,6 +74,11 @@ CheatMenu::CheatMenu()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Events::drawMenuBackgroundEvent += [this]
|
||||||
|
{
|
||||||
|
Hook::show_mouse = false;
|
||||||
|
};
|
||||||
|
|
||||||
Events::shutdownRwEvent += []
|
Events::shutdownRwEvent += []
|
||||||
{
|
{
|
||||||
// Save config data
|
// Save config data
|
||||||
|
@ -34,28 +34,27 @@ class Launcher
|
|||||||
public:
|
public:
|
||||||
Launcher()
|
Launcher()
|
||||||
{
|
{
|
||||||
bool launch = true;
|
Events::initRwEvent += []()
|
||||||
|
|
||||||
uint gameVersion = GetGameVersion();
|
|
||||||
if (gameVersion != GAME_10US_HOODLUM && gameVersion != GAME_10US_COMPACT) {
|
|
||||||
MessageBox(HWND_DESKTOP, "CheatMenu requires v1.0 US of the game.", "CheatMenu", MB_ICONERROR);
|
|
||||||
flog << "Game version isn't 1.0" << std::endl;
|
|
||||||
launch = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
Events::initRwEvent += [&launch]()
|
bool launch = true;
|
||||||
{
|
|
||||||
if (GetModuleHandleA("SAMP.dll")) {
|
|
||||||
MessageBox(HWND_DESKTOP, "SAMP detected. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR);
|
|
||||||
flog << "SAMP detected. Exiting..." << std::endl;
|
|
||||||
launch = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (launch)
|
uint gameVersion = GetGameVersion();
|
||||||
static CheatMenu cheatmenu;
|
if (gameVersion != GAME_10US_HOODLUM && gameVersion != GAME_10US_COMPACT) {
|
||||||
};
|
MessageBox(HWND_DESKTOP, "CheatMenu requires v1.0 US of the game.", "CheatMenu", MB_ICONERROR);
|
||||||
}
|
launch = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetModuleHandleA("SAMP.dll")) {
|
||||||
|
MessageBox(HWND_DESKTOP, "SAMP detected. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR);
|
||||||
|
launch = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (launch)
|
||||||
|
{
|
||||||
|
flog << "Loading CheatMenu" << std::endl;
|
||||||
|
static CheatMenu cheatmenu;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
} launcher;
|
} launcher;
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ HRESULT Hook::PresentDx9(IDirect3DDevice9 *pDevice, RECT* pSourceRect, RECT* pDe
|
|||||||
ImGui::EndFrame();
|
ImGui::EndFrame();
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -121,6 +122,7 @@ HRESULT Hook::PresentDx11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Fl
|
|||||||
ImGui::EndFrame();
|
ImGui::EndFrame();
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -171,7 +173,10 @@ void Hook::ShowMouse(bool state)
|
|||||||
ImGui::GetIO().MouseDrawCursor = state;
|
ImGui::GetIO().MouseDrawCursor = state;
|
||||||
CPad::NewMouseControllerState.X = 0;
|
CPad::NewMouseControllerState.X = 0;
|
||||||
CPad::NewMouseControllerState.Y = 0;
|
CPad::NewMouseControllerState.Y = 0;
|
||||||
|
|
||||||
|
// Broken in psdk
|
||||||
Call<0x541BD0>(); // CPad::ClearMouseHistory
|
Call<0x541BD0>(); // CPad::ClearMouseHistory
|
||||||
|
Call<0x53F1E0>(); // CPad::ClearKeyboardHistory
|
||||||
Call<0x541DD0>(); // CPad::UpdatePads
|
Call<0x541DD0>(); // CPad::UpdatePads
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,18 +474,24 @@ void Vehicle::SpawnVehicle(std::string &smodel)
|
|||||||
if (spawner::license_text != "")
|
if (spawner::license_text != "")
|
||||||
Command<Commands::CUSTOM_PLATE_FOR_NEXT_CAR>(imodel, spawner::license_text);
|
Command<Commands::CUSTOM_PLATE_FOR_NEXT_CAR>(imodel, spawner::license_text);
|
||||||
|
|
||||||
if (!spawner::spawn_inside)
|
if (spawner::spawn_inside)
|
||||||
veh = CCheat::VehicleCheat(imodel);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
int hveh = 0;
|
int hveh = 0;
|
||||||
|
Command<Commands::CREATE_CAR>(imodel, pos.x, pos.y, pos.z + 4.0f, &hveh);
|
||||||
Command<Commands::CREATE_CAR>(imodel, pos.x, pos.y, pos.z, &hveh);
|
|
||||||
veh = CPools::GetVehicle(hveh);
|
veh = CPools::GetVehicle(hveh);
|
||||||
veh->SetHeading(player->GetHeading());
|
veh->SetHeading(player->GetHeading());
|
||||||
Command<Commands::WARP_CHAR_INTO_CAR>(hplayer, hveh);
|
Command<Commands::WARP_CHAR_INTO_CAR>(hplayer, hveh);
|
||||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, speed);
|
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, speed);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int hveh = 0;
|
||||||
|
player->TransformFromObjectSpace(pos, CVector(0, 10, 0));
|
||||||
|
|
||||||
|
Command<Commands::CREATE_CAR>(imodel, pos.x, pos.y, pos.z + 4.0f, &hveh);
|
||||||
|
veh = CPools::GetVehicle(hveh);
|
||||||
|
veh->SetHeading(player->GetHeading()+55.0f);
|
||||||
|
}
|
||||||
CStreaming::SetModelIsDeletable(imodel);
|
CStreaming::SetModelIsDeletable(imodel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,6 +836,7 @@ void Vehicle::Main()
|
|||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
Ui::CheckboxWithHint("Spawn aircraft in air", &spawner::spawn_in_air);
|
Ui::CheckboxWithHint("Spawn aircraft in air", &spawner::spawn_in_air);
|
||||||
ImGui::Columns(1);
|
ImGui::Columns(1);
|
||||||
|
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::SetNextItemWidth(ImGui::GetWindowContentRegionWidth() - 2.5);
|
ImGui::SetNextItemWidth(ImGui::GetWindowContentRegionWidth() - 2.5);
|
||||||
|
Loading…
Reference in New Issue
Block a user