Problem Debugging help

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
So I believe I it set up correctly. I run debug and it loads but no breaks when I press the mouse and now no functions at all:(

Code:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectName>CST100B</ProjectName>
    <ProjectGuid>{6AEC887A-6ADE-4627-9D6B-859F5D7FDE71}</ProjectGuid>
    <RootNamespace>CST100</RootNamespace>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <PlatformToolset>v120</PlatformToolset>
    <CharacterSet>MultiByte</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <PlatformToolset>v120</PlatformToolset>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup>
    <_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <OutDir>..\..\..\Modules\</OutDir>
    <IntDir>.\Debug</IntDir>
    <LinkIncremental>true</LinkIncremental>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <OutDir>..\..\..\Modules\</OutDir>
    <IntDir>.\</IntDir>
    <LinkIncremental>false</LinkIncremental>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>C:\ORBITER2016\Orbitersdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;E3VIP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>true</MinimalRebuild>
      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <PrecompiledHeader />
      <WarningLevel>Level3</WarningLevel>
      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
    </ClCompile>
    <Link>
      <AdditionalDependencies>orbiter.lib;orbitersdk.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>C:\ORBITER2016\Orbitersdk\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
      <IgnoreSpecificDefaultLibraries>msvcrt.lib libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <SubSystem>Windows</SubSystem>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>MaxSpeed</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <AdditionalIncludeDirectories>C:\ORBITER2016\\Orbitersdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;E3VIP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <PrecompiledHeader />
      <WarningLevel>Level3</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
    </ClCompile>
    <Link>
      <AdditionalDependencies>orbiter.lib;Orbitersdk.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <OutputFile>./../../../Modules/CST100B.dll</OutputFile>
      <AdditionalLibraryDirectories>C:\ORBITER2016\Orbitersdk\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <IgnoreSpecificDefaultLibraries>msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClCompile Include="ClassicMfdCST.cpp" />
    <ClCompile Include="CST.CPP" />
    <ClCompile Include="dllmainTALON.cpp" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="AreaIds.h" />
    <ClInclude Include="ClassicMfdCST.h" />
    <ClInclude Include="CST.H" />
    <ClInclude Include="CST100VCMESH.h" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>


P5FVo0X.jpg
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Did you define a panel area?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Yes.
So if I click on where the sphere is then do something.


Code:
bool CST::clbkLoadVC(int id) { // ID is the Preset Camera Position


	mfdController->HandleLoadVC(id);

	oapiVCRegisterArea(AID_NAVMODE1, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN);
	oapiVCRegisterArea(AID_NAVMODE2, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN);
	oapiVCRegisterArea(AID_NAVMODE3, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN);
	oapiVCRegisterArea(AID_NAVMODE4, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN);
	oapiVCRegisterArea(AID_NAVMODE5, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN);
	oapiVCRegisterArea(AID_NAVMODE6, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN);
	oapiVCRegisterArea(AID_NAVMODE7, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN);


	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE1, _V(.484, 1.0551, 2.4273), 0.015);

	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE2, _V(.457, 1.0551, 2.4273), 0.015);
	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE3, _V(.434, 1.0551, 2.4273), 0.015);
	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE4, _V(.409, 1.500178, 1.0551), 2.4273);
	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE5, _V(.384, 1.0551, 2.4273), 0.015);
	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE6, _V(.359, 1.0551, 2.4273), 0.015);
	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE7, _V(.335, 1.0551, 2.4273), 0.015);

	switch (id) {
	case 0: // commander position
		SetCameraOffset(_V(-.2, 1.02, 1.7));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.2), 0, 0, _V(-0.3, 0, 0), 75 * RAD, -5 * RAD, _V(0.3, 0, 0), -20 * RAD, -27 * RAD);
		oapiVCSetNeighbours(-1, 1, 2, 3);


		break;
	case 1: // pilot position
		SetCameraOffset(_V(-0.8, 1.12, 1.7 ));
		SetCameraDefaultDirection(_V(0, 0, 1));
		SetCameraMovement(_V(0, 0, 0.3), 0, 0, _V(-0.3, 0, 0), 20 * RAD, -27 * RAD, _V(0.3, 0, 0), -75 * RAD, -5 * RAD);
		oapiVCSetNeighbours(0, 1, 2, 3);


		break;

	}

	return HandleLoadVC(id);

}

bool CST::HandleLoadVC(UINT const id)
{



	return true;
}

bool CST::clbkVCMouseEvent(int id, int event, VECTOR3 &p)
{
	bool result = false;
	result = result || mfdController->HandleMouseEvent(id, event, p);
	result = result || VCMouseEvent(id, event, p);
	return result;
}

bool CST::VCMouseEvent(int const id, int const event, VECTOR3& const p)
{

	switch (id) {


	case AID_NAVMODE1:
		ToggleNavmode(NAVMODE_KILLROT);
		return true;
	case AID_NAVMODE2:
		ToggleNavmode(NAVMODE_HLEVEL);
		return true;
	case AID_NAVMODE3:
		ToggleNavmode(NAVMODE_PROGRADE);
		return true;
	case AID_NAVMODE4:
		ToggleNavmode(NAVMODE_RETROGRADE);
		return true;
	case AID_NAVMODE5:
		ToggleNavmode(NAVMODE_NORMAL);
		return true;
	case AID_NAVMODE6:
		ToggleNavmode(NAVMODE_ANTINORMAL);
		return true;
	case AID_NAVMODE7:
		ToggleNavmode(NAVMODE_HOLDALT);
		return true;

	}
	return false;
}



bool CST::clbkVCRedrawEvent(int id, int event, SURFHANDLE surf) {
	bool result = false;
	result = result || mfdController->HandleRedrawEvent(id, event, surf);


	result = result || VCRedrawEvent(id, event, surf);
	{}


	return result;
}

bool CST::VCRedrawEvent(int const id, int const event, SURFHANDLE const surf) {
	return false;
}

void CST::clbkMFDMode(int mfd, int mode)
{
	mfdController->HandleMFDMode(mfd, mode);
}
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Can you check this also with a debug string? Maybe you just used the wrong compilation flags.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Like this:
Code:
bool CST::clbkVCMouseEvent(int id, int event, VECTOR3 &p)
{
	bool result = false;
	
	//sprintf_s(oapiDebugString(), 20, "Mode= %d, covers = %d", mode, covers);
	
	result = result || mfdController->HandleMouseEvent(id, event, p);
	result = result || VCMouseEvent(id, event, p);
	return result;

}

bool CST::VCMouseEvent(int const id, int const event, VECTOR3& const p)
{

	switch (id) {
		sprintf_s(oapiDebugString(), 20, "Mode= %d, covers = %d", mode, covers);

I get mouse working on the mfd but debugstring here
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Yes, but with id and event as well
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Ok. So I know the mouse is clicking. But it is not registering I am clinking in the 3d area, right?

I am using a 3d mesh for the clickable area
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Ok. So I know the mouse is clicking. But it is not registering I am clinking in the 3d area, right?

I am using a 3d mesh for the clickable area


Thats not important, the area you defined is. If you did everything right, clicking at the right pixel on the screen should result in a reaction.



If not - the question is where did it fail: Was something required not executed? Is something that follows not executing? Is it the right binary?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
So what I did you get the definitions was to put a sphere in the mesh where I wanted to push and got the reference point from that.
Code:
	SetMeshVisibilityMode(meshi_VC = AddMesh(meshhg_VC = oapiLoadMeshGlobal("CST-100\\CST-100-newpanelC")), MESHVIS_VC);
	mfdController->HandleLoadMesh(meshi_VC, meshhg_VC);

	SetMeshVisibilityMode(AddMesh(cmMesh, &ofs), MESHVIS_EXTERNAL | MESHVIS_VC);
	SetMeshVisibilityMode(AddMesh(hatchMesh, &ofs), MESHVIS_EXTERNAL | MESHVIS_VC);


dy7KENV.jpg




So is there a way to read where the mouse click point is?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
So is there a way to read where the mouse click point is?


Yeah, the final VECTOR3& parameter in clbkVCMouseEvent.


If you are not sure if you are hitting the right location, place a simple rectangular area in front of the camera and click on it. You can calculate the position in the mesh then from the corners of the rectangle, as linear combination.


https://en.wikipedia.org/wiki/Linear_combination
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Thanks.
Code:
	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE1, _V(.484, 1.0551, 2.426), 0.55);

	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE2, _V(.457, 1.0551, 2.426), 1.55);
	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE3, _V(.434, 1.0551, 2.426), 0.55);
	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE4, _V(.409, 1.0551, 2.426), 1.55);
	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE5, _V(.384, 1.0551, 2.426), 1.55);
	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE6, _V(.359, 1.0551, 2.426), 0.55);
	oapiVCSetAreaClickmode_Spherical(AID_NAVMODE7, _V(.335, 1.0551, 2.426), 1.55);

So when I click nav mode 7 always comes on. I may need to space the buttons out.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Sounds like a good idea, since you use 1.55 meters radius there for buttons that are just 2.3 centimeters (0.023 m) apart. But the event arrives.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Thanks. I opened the mesh in meshwizard and I had the x values off. I made them -x and now it works.

When running debug though it froze up when I clicked the mouse
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Yes. It froze when hitting a break point. But it does work:)
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Yes. It froze when hitting a break point. But it does work:)


Well, remember to unpause the execution in VS if you don't want it to stay frozen. :lol:
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Unpause? It froze in game and didn't break to VS

Thats odd. Usually it should just fail if you have a breakpoint but no VS reacting to it.
 
Top