Skip to content

Commit

Permalink
Update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
user-grinch committed Jul 24, 2024
1 parent d2ff94c commit 9c0a77a
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 46 deletions.
19 changes: 9 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,47 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "Launch Game",
"name": "Launch SS",
"type": "cppvsdbg",
"request": "launch",
"program": "D:/Games/Bully/Bully.exe",
"program": "${env:GTA_SS_DIR}/gta_sa.exe",
"args": [],
"stopAtEntry": false,
"cwd": "D:/Games/Bully/",
"cwd": "${env:GTA_SS_DIR}",
"environment": [],
"console": "internalConsole"
},
{
"name": "Launch SA",
"type": "cppvsdbg",
"request": "launch",
"program": "H:/GTA San Andreas/gta_sa.exe",
"program": "${env:GTA_SA_DIR}/gta_sa.exe",
"args": [],
"stopAtEntry": false,
"cwd": "H:/GTA San Andreas/",
"cwd": "${env:GTA_SA_DIR}",
"environment": [],
"console": "internalConsole"
},
{
"name": "Launch VC",
"type": "cppvsdbg",
"request": "launch",
"program": "E:/GTA Vice City/gta-vc.exe",
"program": "${env:GTA_VC_DIR}/gta-vc.exe",
"args": [],
"stopAtEntry": false,
"cwd": "F:/GTASanAndreas/",
"cwd": "${env:GTA_VC_DIR}",
"environment": [],
"console": "internalConsole"
},
{
"name": "Launch III",
"type": "cppvsdbg",
"request": "launch",
"program": "E:/GTA3/Gta3.exe",
"program": "${env:GTA_III_DIR}/Gta3.exe",
"args": [],
"stopAtEntry": false,
"cwd": "F:/GTASanAndreas/",
"cwd": "${env:GTA_III_DIR}",
"environment": [],
"console": "internalConsole"
},
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"xutility": "cpp",
"*.rh": "cpp",
"any": "cpp",
"deque": "cpp"
"deque": "cpp",
"stack": "cpp"
}
}
51 changes: 40 additions & 11 deletions src/opcodemgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,51 @@ static RTN_TYPE RUNTIME_API ImGuiBegin(RUNTIME_CONTEXT ctx) {
ScriptExData* data = ScriptExData::Get();
data->imgui += [=]() {
bool isOpen = openFlag;
ImGui::Begin(label, &isOpen, flags);
data->SetData(label, 0, isOpen);
if (isOpen) {
ImGui::Begin(label, &isOpen, flags);
data->SetData(label, 0, isOpen);
}
};
data->imgui.lastScriptCall = time(NULL);
wUpdateCompareFlag(ctx, data->GetData(label, 0, true));
wUpdateCompareFlag(ctx, data->GetData(label, 0, false));
return RTN_CONTINUE;
}

static RTN_TYPE RUNTIME_API ImGuiEnd(RUNTIME_CONTEXT ctx) {
ScriptExData* data = ScriptExData::Get();
data->imgui += [=]() {
ImGui::End();
};
return RTN_CONTINUE;
}

// static RTN_TYPE RUNTIME_API ImGuiBegin(RUNTIME_CONTEXT ctx) {
// char label[RUNTIME_STR_LEN];

// wGetStringWithFrame(ctx, label, RUNTIME_STR_LEN);
// bool openFlag = wGetBoolParam(ctx);
// bool noTitleBar = wGetBoolParam(ctx);
// bool noResize = wGetBoolParam(ctx);
// bool noMove = wGetBoolParam(ctx);
// bool autoResize = wGetBoolParam(ctx);

// ImGuiWindowFlags flags = ImGuiWindowFlags_NoCollapse;
// if (noTitleBar) flags |= ImGuiWindowFlags_NoTitleBar;
// if (noResize) flags |= ImGuiWindowFlags_NoResize;
// if (noMove) flags |= ImGuiWindowFlags_NoMove;
// if (autoResize) flags |= ImGuiWindowFlags_AlwaysAutoResize;

// ScriptExData* data = ScriptExData::Get();
// data->imgui += [=]() {
// bool isOpen = openFlag;
// ImGui::Begin(label, &isOpen, flags);
// data->SetData(label, 0, isOpen);
// };
// data->imgui.lastScriptCall = time(NULL);
// wSetIntParam(ctx, data->GetData(label, 0, true));
// return RTN_CONTINUE;
// }

static RTN_TYPE RUNTIME_API ImGuiButton(RUNTIME_CONTEXT ctx) {
char buf[RUNTIME_STR_LEN];
ImVec2 size;
Expand Down Expand Up @@ -205,14 +242,6 @@ static RTN_TYPE RUNTIME_API ImGuiCheckbox(RUNTIME_CONTEXT ctx) {
return RTN_CONTINUE;
}

static RTN_TYPE RUNTIME_API ImGuiEnd(RUNTIME_CONTEXT ctx) {
ScriptExData* data = ScriptExData::Get();
data->imgui += [=]() {
ImGui::End();
};
return RTN_CONTINUE;
}

static RTN_TYPE RUNTIME_API ImGuiSameLine(RUNTIME_CONTEXT ctx) {
ScriptExData* data = ScriptExData::Get();

Expand Down
8 changes: 4 additions & 4 deletions tools/Debug.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ echo --------------------------------------------------
echo[
call "tools\Setup.bat"
MsBuild ImGuiRedux.sln /property:Configuration=Debug /t:ImGuiRedux /property:Platform=Win32
del %OUT_DIR%"\cleo\CLEO_PLUGINS\ImGuiReduxWin32.cleo" /Q
del %OUT_DIR%"\cleo\CLEO_PLUGINS\ImGuiReduxWin32.pdb" /Q
xcopy /s "bin\ImGuiReduxWin32.cleo" %OUT_DIR%"\cleo\CLEO_PLUGINS\" /K /D /H /Y
xcopy /s "bin\ImGuiReduxWin32.pdb" %OUT_DIR%"\cleo\CLEO_PLUGINS\" /K /D /H /Y
del "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\ImGuiReduxWin32.cleo" /Q
del "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\ImGuiReduxWin32.pdb" /Q
xcopy /s "bin\ImGuiReduxWin32.cleo" "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\" /K /D /H /Y
xcopy /s "bin\ImGuiReduxWin32.pdb" "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\" /K /D /H /Y
8 changes: 4 additions & 4 deletions tools/Debug64.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ echo --------------------------------------------------
echo[
call "tools\Setup.bat"
MsBuild ImGuiRedux.sln /property:Configuration=Release /t:ImGuiRedux /property:Platform=Win64
del %OUT_DIR%"\cleo\CLEO_PLUGINS\ImGuiReduxWin64.cleo" /Q
del %OUT_DIR%"\cleo\CLEO_PLUGINS\ImGuiReduxWin64.pdb" /Q
xcopy /s "bin\ImGuiReduxWin64.cleo" %OUT_DIR%"\cleo\CLEO_PLUGINS\" /K /D /H /Y
xcopy /s "bin\ImGuiReduxWin64.pdb" %OUT_DIR%"\cleo\CLEO_PLUGINS\" /K /D /H /Y
del "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\ImGuiReduxWin64.cleo" /Q
del "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\ImGuiReduxWin64.pdb" /Q
xcopy /s "bin\ImGuiReduxWin64.cleo" "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\" /K /D /H /Y
xcopy /s "bin\ImGuiReduxWin64.pdb" "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\" /K /D /H /Y
8 changes: 4 additions & 4 deletions tools/DebugCleo.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ echo --------------------------------------------------
echo[
call "tools\Setup.bat"
MsBuild ImGuiRedux.sln /property:Configuration=DebugCleo /t:ImGuiRedux /property:Platform=Win32
del %OUT_DIR%"\cleo\CLEO_PLUGINS\ImGuiCleoWin32.cleo" /Q
del %OUT_DIR%"\cleo\CLEO_PLUGINS\ImGuiCleoWin32.pdb" /Q
xcopy /s "bin\ImGuiCleoWin32.cleo" %OUT_DIR%"\cleo\CLEO_PLUGINS\" /K /D /H /Y
xcopy /s "bin\ImGuiCleoWin32.pdb" %OUT_DIR%"\cleo\CLEO_PLUGINS\" /K /D /H /Y
del "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\ImGuiCleoWin32.cleo" /Q
del "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\ImGuiCleoWin32.pdb" /Q
xcopy /s "bin\ImGuiCleoWin32.cleo" "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\" /K /D /H /Y
xcopy /s "bin\ImGuiCleoWin32.pdb" "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\" /K /D /H /Y
4 changes: 2 additions & 2 deletions tools/Release.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ echo --------------------------------------------------
echo[
call "tools\Setup.bat"
MsBuild ImGuiRedux.sln /property:Configuration=Release /t:ImGuiRedux /property:Platform=Win32
del %OUT_DIR%"\cleo\CLEO_PLUGINS\ImGuiReduxWin32.cleo" /Q
xcopy /s "bin\ImGuiReduxWin32.cleo" %OUT_DIR%"\cleo\CLEO_PLUGINS\" /K /D /H /Y
del "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\ImGuiReduxWin32.cleo" /Q
xcopy /s "bin\ImGuiReduxWin32.cleo" "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\" /K /D /H /Y
4 changes: 2 additions & 2 deletions tools/Release64.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ echo --------------------------------------------------
echo[
call "tools\Setup.bat"
MsBuild ImGuiRedux.sln /property:Configuration=Release /t:ImGuiRedux /property:Platform=Win64
del %OUT_DIR%"\cleo\CLEO_PLUGINS\ImGuiReduxWin64.cleo" /Q
xcopy /s "bin\ImGuiReduxWin64.cleo" %OUT_DIR%"\cleo\CLEO_PLUGINS\" /K /D /H /Y
del "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\ImGuiReduxWin64.cleo" /Q
xcopy /s "bin\ImGuiReduxWin64.cleo" "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\" /K /D /H /Y
4 changes: 2 additions & 2 deletions tools/ReleaseCleo.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ echo --------------------------------------------------
echo[
call "tools\Setup.bat"
MsBuild ImGuiRedux.sln /property:Configuration=ReleaseCleo /t:ImGuiRedux /property:Platform=Win32
del %OUT_DIR%"\cleo\CLEO_PLUGINS\ImGuiReduxWin32.cleo" /Q
xcopy /s "bin\ImGuiReduxWin32.cleo" %OUT_DIR%"\cleo\CLEO_PLUGINS\" /K /D /H /Y
del "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\ImGuiReduxWin32.cleo" /Q
xcopy /s "bin\ImGuiReduxWin32.cleo" "%GTA_SA_DIR%\cleo\CLEO_PLUGINS\" /K /D /H /Y
49 changes: 43 additions & 6 deletions tools/Setup.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
rem Generate visual studio files and run the devcmd init
@echo off
set "projectdir=%CD%"
set "PLUGIN_NAME="GrinchTrainer""

rem Set game paths below
set "OUT_DIR="H:/GTA San Andreas""
:find_vs_path
set "vs_path="
for %%d in (Community Preview Professional) do (
for /d %%e in ("C:\Program Files\Microsoft Visual Studio\2022\%%d") do (
if exist "%%e\Common7\Tools\VsDevCmd.bat" (
set "vs_path=%%e"
goto :check_game_path
)
)
)
goto :eof

cd tools
:check_game_path
if "%GTA_SA_DIR%"=="" (
echo Error: GTA_SA_DIR environment variable is not set.
)

if "%GTA_VC_DIR%"=="" (
echo Error: GTA_VC_DIR environment variable is not set.
)

if "%GTA_III_DIR%"=="" (
echo Error: GTA_III_DIR environment variable is not set.
)

if "%GTA_SS_DIR%"=="" (
echo Error: GTA_SS_DIR environment variable is not set.
)
echo[

:vs_install_found
if not defined vs_path (
echo Error: Visual Studio installation not found.
exit /b 1
)

:run_premake
cd "%projectdir%\tools"
premake5.exe vs2022
cd ../build
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"

:run_dev
cd "%projectdir%\build"
call %vs_path%"\Common7\Tools\VsDevCmd.bat"

0 comments on commit 9c0a77a

Please sign in to comment.