'NS_ITEMINFO::AddTextNoSplit' : cannot convert parameter 1 from 'BYTE' to 'CString' - c++

I get a compilation error on the line:
GLPADATA &sDamage = sItemCustom.getdamage();
nExtraValue = sItemCustom.GETGRADE_DAMAGE();
uGRADE = sItemCustom.GETGRADE(EMGRINDING_DAMAGE);
AddInfoItemAddonRange ( sDamage.dwLow, sDamage.dwHigh, nExtraValue, uGRADE,ID2GAMEWORD("ITEM_ADVANCED_INFO", 0) );
AddTextNoSplit (uGRADE, NS_UITEXTCOLOR::GOLD);
I don't know how to resolve this error, and what I'm trying to do is to have the uGRADE a different color from the default color of ID2GAMEWORD. I'm currently still learning

Related

question about VkPhysicalDeviceVulkan12Features

I ran into an issue when adding features to a physical device using bootstrap https://github.com/charles-lunarg/vk-bootstrap. Doing so gives me assertion failed
Assertion failed: m_init, file \vkbootstrap\VkBootstrap.h, line 132
I understand that this could indicate a bug within the vk-bootstrap source, but I wanted to rule out that it's my own fault. Here is the code snippet which im using to add (empty)VkPhysicalDeviceVulkan12Features into physical device and I wanted to know if I'm intializing it correctly
VkPhysicalDeviceVulkan12Features feat;
feat.pNext = nullptr;
feat.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
vkb::PhysicalDeviceSelector selector{ vkb_inst };
vkb::PhysicalDevice physicalDevice = selector
.set_minimum_version(1, 2)
.set_surface(_surface)
.set_required_features_12(feat)
.select()
.value();
You are not checking Results for errors.
Probably should be something like:
vkb::PhysicalDeviceSelector selector{ vkb_inst };
auto maybe_device = selector.select();
if( !maybe_device ) panic( maybe_device.error() );
vkb::PhysicalDevice device = maybe_device.value();

CreateDepthStencilView() is failing

I'm trying to create a shadow map in my DirectX application, but currently having trouble when creating the Depth Stencil view. CreateDepthStencilView() is leaving my ID3D11DepthStencilView* variable as NULL.
The only error I've managed to get from the HRESULT is "The parameter is incorrect". It seems the problem is with both the D3D11_TEXTURE2D_DESC and the ID3D11_DEPTH_STENCIL_VIEW_DESC as when I've replaced them with the depth texture and nullptr respectively, it works. I then replaced the working function parameters with the shadow map values one at a time and it did not work with either.
I have also tried setting shadowDsv.Flags = 0 , as suggested in this post, but had the same result.
I'm following this tutorial, the code is the same as his (except mine is DX11 not DX10), I'm unsure what the problem could be. This is my code:
Application.h
ID3D11Texture2D* _shadowMapTexture;
ID3D11DepthStencilView* _shadowMapStencil;
ID3D11ShaderResourceView* _shadowMapRV;
Application.cpp
//Set up shadow map
D3D11_TEXTURE2D_DESC shadowTexDesc;
shadowTexDesc.Width = _WindowWidth;
shadowTexDesc.Height = _WindowHeight;
shadowTexDesc.MipLevels = 1;
shadowTexDesc.ArraySize = 1;
shadowTexDesc.Format = DXGI_FORMAT_R32_TYPELESS;
shadowTexDesc.SampleDesc.Count = 1;
shadowTexDesc.SampleDesc.Quality = 0;
shadowTexDesc.Usage = D3D11_USAGE_DEFAULT;
shadowTexDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
shadowTexDesc.CPUAccessFlags = 0;
shadowTexDesc.MiscFlags = 0;
D3D11_DEPTH_STENCIL_VIEW_DESC shadowDsv;
shadowDsv.Format = shadowTexDesc.Format;
shadowDsv.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
shadowDsv.Texture2D.MipSlice = 0;
D3D11_SHADER_RESOURCE_VIEW_DESC shadowSrv;
shadowSrv.Format = DXGI_FORMAT_R32_FLOAT;
shadowSrv.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
shadowSrv.Texture2D.MipLevels = shadowTexDesc.MipLevels;
shadowSrv.Texture2D.MostDetailedMip = 0;
hr = _pd3dDevice->CreateTexture2D(&shadowTexDesc, nullptr, &_shadowMapTexture);
hr = _pd3dDevice->CreateDepthStencilView(_shadowMapTexture, &shadowDsv, &_shadowMapStencil);
hr = _pd3dDevice->CreateShaderResourceView(_shadowMapTexture, &shadowSrv, &_shadowMapRV);
EDIT:
This is the console output when CreateDepthStencilView() is called. Thank you for the help so far.
D3D11 ERROR: ID3D11Device::CreateDepthStencilView: The Format (0x27, R32_TYPELESS) is invalid, when creating a View; it is not a fully qualified Format castable from the Format of the Resource (0x27, R32_TYPELESS). [ STATE_CREATION ERROR #144: CREATEDEPTHSTENCILVIEW_INVALIDFORMAT]
D3D11 ERROR: ID3D11Device::CreateDepthStencilView: The format (0x27, R32_TYPELESS) cannot be used with a DepthStencil view. [ STATE_CREATION ERROR #144: CREATEDEPTHSTENCILVIEW_INVALIDFORMAT]
D3D11 ERROR: ID3D11Device::CreateDepthStencilView: There were unrecognized flags specified in the DepthStencilView Flags field. The flags value was 0xcccccccc, while the valid flags are limited to 0x3. [ STATE_CREATION ERROR #2097153: CREATEDEPTHSTENCILVIEW_INVALIDFLAGS]
Exception thrown at 0x76D235D2 in DX11 Framework.exe: Microsoft C++ exception: _com_error at memory location 0x00B3EE98.
D3D11 ERROR: ID3D11Device::CreateDepthStencilView: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #148: CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN]
It seems the R32_TYPELESS format is what's causing the error. After looking at the documentation I see there are only a few allowable formats. Does anyone recommend a specific format for a shadow map? I've not done this before so unsure if any of the following would be a good subsitute:
DXGI_FORMAT_D16_UNORM
DXGI_FORMAT_D24_UNORM_S8_UINT
DXGI_FORMAT_D32_FLOAT
DXGI_FORMAT_D32_FLOAT_S8X24_UINT
DXGI_FORMAT_UNKNOWN
Thanks again :)
To anyone else having this problem: my fix was to set the D3D11_DEPTH_STENCIL_VIEW_DESC format to DXGI_FORMAT_D32_FLOAT, and the D3D11_DEPTH_STENCIL_VIEW_DESC Flags equal to 0.

selecting attitude reference frame in IOS 10 coremotion using swift 3

I am trying to use CMMotionManager to update the attitude of a camera viewpoint in scenekit. I am able to get the following code using the default reference to work.
manager.deviceMotionUpdateInterval = 0.01
manager.startDeviceMotionUpdates(to: motionQueue, withHandler:{ deviceManager, error in
if (deviceManager?.attitude) != nil {
let rotation = deviceManager?.attitude.quaternion
OperationQueue.main.addOperation {
self.cameraNode.rotation = SCNVector4(rotation!.x,rotation!.y,rotation!.z,rotation!.w)
}
}
})
I am however unable to get startDeviceMotionUpdates to work with a selected reference frame as shown below:
manager.deviceMotionUpdateInterval = 0.01
manager.startDeviceMotionUpdates(using: CMAttitudeReferenceFrameXMagneticNorthZVertical, to: motionQueue, withHandler:{ deviceManager, error in
if (deviceManager?.attitude) != nil {
let rotation = deviceManager?.attitude.quaternion
OperationQueue.main.addOperation {
self.cameraNode.rotation = SCNVector4(rotation!.x,rotation!.y,rotation!.z,rotation!.w)
}
}
})
The error i receive is:
Use of unresolved identifier 'CMAttitudeReferenceFrameXMagneticNorthZVertical'
I get similar error messages for other reference frames as well. Can anyone shed any light on the use of the "using:" parameter for the startDeviceMotionUpdates function? All the examples i have found are for older versions of swift or objective c so it is quite possible that it is simply an issue with not understanding Swift 3 syntax.
After some additional fiddling i figured out that the using argument expects a member of the new CMAttitudeReferenceFrame struct. i.e. it should be passed as:
manager.deviceMotionUpdateInterval = 0.01
manager.startDeviceMotionUpdates(using: CMAttitudeReferenceFrame.xMagneticNorthZVertical
,to: motionQueue, withHandler:{
deviceManager, error in
if (deviceManager?.attitude) != nil {
let rotation = deviceManager?.attitude.quaternion
OperationQueue.main.addOperation {
self.cameraNode.rotation = SCNVector4(rotation!.x,rotation!.y,rotation!.z,rotation!.w)
}
}
})
This is a change from earlier version that allowed the direct use of constants such as "CMAttitudeReferenceFrameXMagneticNorthZVertical"

How to use IF statement that provided by DoctrineExtensions

I'm playing with DoctrineExtensions but can not manage it. After register DoctrineExtensions, I have following line of DQL with Zend Framework:
$qb->having(new IfElse("A.type = 0", new FindInSet(1, new GroupConcat('B.id', ',')) >0 , '1') );
But get this error msg:
Exception information:
Message: Expression of type 'DoctrineExtensions\Query\Mysql\IfElse'
not allowed in this context.*
Could you help me to point out what incorrect in my command or any document on how to use DoctrineExtensions?
UPDATED:
I've found a the way to implement custom function by :
I have given it a litle try by adding this line to boostrap:
$config->addCustomStringFunction('IF', 'DoctrineExtensions\Query\Mysql\IfElse');
And use it in DQL as:
$qb->having("IF( A.type = 0, S.status = 0, S.status = 1 )");
But get this error:
Message: [Syntax Error] line 0, col 152: Error: Expected Doctrine\ORM\Query\Lexer::T_COMMA, got '='
Maybe I'm wrong in syntax?
Have you tried
$qb->having("S.status = IF( A.type = 0, 0, 1 )");

Boost Filesystem Compile Error

I'm writing some code that utilizes the boost filesystem library. Here is an excerpt of my code:
artist = (this->find_diff(paths_iterator->parent_path(), this->m_input_path) == 1) ? (*(paths_iterator->parent_path().end() - 1)) : (*(paths_iterator->parent_path().end() - 2));
album = (this->find_diff(paths_iterator->parent_path(), this->m_input_path) == 1) ? "" : (*(paths_iterator->parent_path().end() - 1));
Types:
artist and album are of type std::string
this->find_diff returns an int
this->m_input_path is a std::string
paths_iterator is of type std::vector(open bracket)boost::filesystem::path>::iterator
I get a compile error:
error C2039: 'advance' : is not a member of 'boost::filesystem::basic_path<String,Traits>::iterator' d:\development\libraries\boost\boost\iterator\iterator_facade.hpp on line 546
This code is part of a program that outputs a batch script that uses lame.exe to convert files into mp3s.
The music library this is designed for has the format:
root/artist/song
OR
root/artist/album/song
this->m_input_path is the path to root.
I'm not sure if I'm approaching the problem properly. If I am, how do I fix the error that I am getting?
EDIT:
My code is now:
boost::filesystem::path::iterator end_path_itr = paths_iterator->parent_path().end();
if(this->find_diff(paths_iterator->parent_path(), this->m_input_path) == 1) /* For cases where: /root/artist/song */
{
album = "";
end_path_itr--;
artist = *end_path_itr;
}
else /* For cases where: /root/artist/album/song */
{
end_path_itr--;
album = *end_path_itr;
end_path_itr--; <-- Crash Here
artist = *end_path_itr;
}
The error that I now get is:
Assertion failed: itr.m_pos && "basic_path::iterator decrement pat begin()", file ... boost\filesystem\path.hpp, line 1444
basic_path::iterator is a bidirectional iterator. So arithmetic with -1 and -2 is not allowed. Operators + and - between an iterator and an integer value is defined for a RandomAccessIterator.
Instead of using .end()-1, you could resort to using --.
Your new error indicates that your end_path_iter doesn't have enough elements (should that be "decrement past begin"?), i.e. your path is shorter than you expect.