Fix Hopper selection crash, add some placeholder enums, add a compaitiblity shim

This commit is contained in:
2022-10-04 23:36:59 -04:00
parent 8ef3bcd352
commit 3b83e527f8
6 changed files with 69 additions and 6 deletions

3
.gitignore vendored
View File

@@ -53,4 +53,5 @@ desktop.ini
*.db *.db
#Redist #Redist
!Installer/Redist/* !Installer/Redist/*
UpgradeLog.htm

View File

@@ -733,6 +733,14 @@
RelativePath=".\src\include\TextureHandler.h" RelativePath=".\src\include\TextureHandler.h"
> >
</File> </File>
<File
RelativePath=".\src\include\ToolEnum.h"
>
</File>
<File
RelativePath=".\src\include\VS2005CompatShim.h"
>
</File>
<File <File
RelativePath=".\src\include\win32Defines.h" RelativePath=".\src\include\win32Defines.h"
> >

View File

@@ -22,7 +22,7 @@
} }
</style> </style>
<body style="background-color: ButtonFace; margin: 0; padding: 5px; overflow: hidden; border: outset 2px;"> <body style="background-color: ButtonFace; margin: 0; padding: 5px; overflow: hidden; border: outset 2px;">
<span class="container" onmousedown="toolOvr(this)" onmouseup="toolOut(this)" onmouseout="toolOut(this)" onclick="alert(window.external.ToggleHopperBin(0))"> <span class="container" onmousedown="toolOvr(this)" onmouseup="toolOut(this)" onmouseout="toolOut(this)" onclick="window.external.ToggleHopperBin(0)">
<img src="../images/GameTool.png" /> <img src="../images/GameTool.png" />
</span> </span>
<span class="container" onmousedown="toolOvr(this)" onmouseup="toolOut(this)" onmouseout="toolOut(this)" onclick="window.external.ToggleHopperBin(1)"> <span class="container" onmousedown="toolOvr(this)" onmouseup="toolOut(this)" onmouseout="toolOut(this)" onclick="window.external.ToggleHopperBin(1)">

11
src/include/ToolEnum.h Normal file
View File

@@ -0,0 +1,11 @@
#pragma once
namespace Enum
{
namespace Hopper
{
enum Value {
GameTool = 0, Grab = 1, Clone = 2, Hammer = 3, Slingshot = 4, Rocket = 5, Laser = 6
};
}
}

View File

@@ -0,0 +1,26 @@
#ifndef COMPAT_SHIM
#define COMPAT_SHIM
#include <sstream>
#include <string>
template<class T>
std::string toString(const T &value)
{
std::ostringstream os;
os << value;
return os.str();
}
namespace std
{
std::string to_string( int value ) {return toString(value);}
std::string to_string( long value ) {return toString(value);}
std::string to_string( long long value ) {return toString(value);}
std::string to_string( unsigned value ) {return toString(value);}
std::string to_string( unsigned long value ) {return toString(value);}
std::string to_string( unsigned long long value ) {return toString(value);}
std::string to_string( float value ) {return toString(value);}
std::string to_string( double value ) {return toString(value);}
std::string to_string( long double value ) {return toString(value);}
}
#endif

View File

@@ -2,7 +2,6 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#include <windows.h> #include <windows.h>
#include <Commdlg.h> #include <Commdlg.h>
#include "IEBrowser.h" #include "IEBrowser.h"
@@ -11,6 +10,9 @@
#include "ax.h" #include "ax.h"
#include "Tool/SurfaceTool.h" #include "Tool/SurfaceTool.h"
#include "Application.h" #include "Application.h"
#include "Enum.h"
#include "ToolEnum.h"
#include "VS2005CompatShim.h"
HRESULT IEBrowser::doExternal(std::wstring funcName, HRESULT IEBrowser::doExternal(std::wstring funcName,
DISPID dispIdMember, DISPID dispIdMember,
@@ -30,9 +32,24 @@ HRESULT IEBrowser::doExternal(std::wstring funcName,
} }
else if (funcName==L"ToggleHopperBin") else if (funcName==L"ToggleHopperBin")
{ {
pVarResult->vt = VT_INT; MessageBox(NULL, "BOOP", "Boopity boop",MB_OK);
pVarResult->intVal = 5;
//MessageBox(NULL, "BOOP", "Boopity boop",MB_OK); /*To-do Make enums in ToolEnum work with this properly,
commented code is not fully tested.*/
/*MessageBox(NULL,
std::to_string(pDispParams->rgvarg->intVal).c_str(),
"Is it working?",
MB_OK);
Enum::Hopper::Value cont = (Enum::Hopper::Value)pDispParams->rgvarg->intVal;
switch (cont)
{
case GameTool
case Grab
break;
}*/
return S_OK;
} }
else if (funcName==L"SetController") else if (funcName==L"SetController")
{ {