|
I downloaded Argon2 source[^] for Java, and in it's code it's using JNA, so I also got JNA source[^]. Now the problem I have is that the JNA code also needs some DLL files, but inside the repository for JNA[^] it doesn't contain a .sln project to use that with Visual Studio and build the .dll files, but instead it has makefile, and I don't know how to use it. Can someone help me on how to build the .dll files from that repository? I need jnidispatch.dll.
For both Argon2 and JNA I choose the path using the source code and building them myself because that is what I need for the project I have, and I can't use them already compiled/jars.
C/C++ isn't something that I use as main language for any of my projects, but I can make some basic .dll files using Visual Studio for stuff that can't be made inside Java, but I never had to use makefiles, and they aren't something I was able to understand.
Even tho Java can be used on multiple OS, I only need it for Windows.
|
|
|
|
|
|
Mircea Neacsu wrote: if the DLL you need is libffi
JohnCodding wrote: I need jnidispatch.dll.
That is the DLL file I need. At least that is the first exception I get, maybe after I add that DLL I'll need another, or not, not sure.
|
|
|
|
|
|
At the bottom of the GitHub repository for JNA I found this[^]. I'll try to follow that tomorrow, maybe with that I'll get all that I need.
|
|
|
|
|
Due to all the problems in getting this to work, and also because in the project that I was going to use I'm not saving any really personal information, I'm going to stick with PBKDF2WithHmacSHA512 for password hashing.
|
|
|
|
|
I was trying to get gamma value of monitor using GetVCPFeatureAndVCPFeatureReply[^] to have the default value, and later when using SetVCPFeature[^] to be able to revert to it. But when GetVCPFeatureAndVCPFeatureReply is called, it fails. What am I doing wrong? Here is the code test:
#include <Windows.h>
#include <lowlevelmonitorconfigurationapi.h>
#include <iostream>
#include <chrono>
#include <thread>
#pragma comment(lib, "Dxva2.lib")
int main() {
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
HWND hwnd = GetForegroundWindow();
HMONITOR hMonitor = NULL;
DWORD cPhysicalMonitors;
LPPHYSICAL_MONITOR pPhysicalMonitors = NULL;
hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
BOOL bSuccess = GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, &cPhysicalMonitors);
if (bSuccess) {
pPhysicalMonitors = (LPPHYSICAL_MONITOR)malloc(cPhysicalMonitors * sizeof(PHYSICAL_MONITOR));
if (pPhysicalMonitors != NULL) {
bSuccess = GetPhysicalMonitorsFromHMONITOR(hMonitor, cPhysicalMonitors, pPhysicalMonitors);
if (bSuccess) {
DWORD pdwCurrentValue;
DWORD pdwMaximumValue;
bSuccess = GetVCPFeatureAndVCPFeatureReply(pPhysicalMonitors->hPhysicalMonitor, 0x72, NULL, &pdwCurrentValue, &pdwMaximumValue);
if (bSuccess) {
std::cout << "Current value: " << pdwCurrentValue << " | MaximumValue: " << pdwMaximumValue;
}
else {
std::cout << "Failed GetVCPFeatureAndVCPFeatureReply" << std::endl;
}
}
else {
std::cout << "Failed GetPhysicalMonitorsFromHMONITOR" << std::endl;
}
DestroyPhysicalMonitors(cPhysicalMonitors, pPhysicalMonitors);
free(pPhysicalMonitors);
}
else {
std::cout << "Is null" << std::endl;
}
}
else {
std::cout << "Failed GetNumberOfPhysicalMonitorsFromHMONITOR" << std::endl;
}
return 0;
}
|
|
|
|
|
On function call failure, why didn't you call GetLastError, as hinted by the documentation[^]?
Also, at the very beginning of the linked page, there is:
The physical monitor configuration functions work using the VESA Monitor Control Command Set (MCCS) standard over an I2C interface. Many monitors don't fully implement that standard; so your use of these commands might result in undefined monitor behavior. We don't recommend using these functions for arbitrary monitors without physically validating that they work as intended.
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
CPallini wrote: On function call failure, why didn't you call GetLastError, as hinted by the documentation[^]?
I don't know how to use it. C/C++ isn't my main language, and only use it when I have to.
CPallini wrote: Also, at the very beginning of the linked page, there is:
That is not a problem for my monitor.
|
|
|
|
|
|
I'm going to look for other ways to change gamma and brightness as this function has too many limitations on hardware. In the past I used SetDeviceGammaRamp[^] for changing gamma, but now it seems that function shouldn't be used anymore.
If anyone has some suggestion, they are welcomed and helpful.
|
|
|
|
|
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gfx.hpp>
using namespace gfx;
template <typename Source>
void print_ascii(const Source& src) {
static const char* col_table = " .,-~;+=x!1%$O@#";
for (int y = 0; y < src.dimensions().height; ++y) {
for (int x = 0; x < src.dimensions().width; ++x) {
typename Source::pixel_type px;
src.point(point16(x, y), &px);
const auto px2 = convert<typename Source::pixel_type, gsc_pixel<4>>(px);
size_t i = px2.template channel<channel_name::L>();
putchar(col_table[i]);
}
putchar('\r'); putchar('\n');
}
}
int main(int argc, char** argv) {
if(argc>1) { float scale = 1; if(argc>2) { int pct = atoi(argv[2]);
if(pct>0 && pct<1000) {
scale = ((float)pct/100.0f);
}
}
file_stream fs(argv[1]);
svg_doc doc;
svg_doc::read(&fs,&doc);
fs.close();
auto bmp = create_bitmap<gsc_pixel<4>>(
{uint16_t(doc.dimensions().width*scale),
uint16_t(doc.dimensions().height*scale)});
if (bmp.begin()) {
bmp.clear(bmp.bounds());
draw::svg(bmp,bmp.bounds(),doc,scale);
print_ascii(bmp);
free(bmp.begin());
}
}
return (argc<1);
}
And there's this documentation[^]
I was wondering how difficult it is to follow. I'm most interested in terms of what it looks like to use my graphics library as above. Is it confusing? intuitive? I've had precious little feedback on it.
Note that I am not using the STL for things like iostream because this is primarily IoT and embedded, and the STL is limited on some of my targets.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Even "lower case" comments without punctuation are "jarring" for some people. One can never be too well dressed; especially when out in public.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Ha! What's jarring to me is
When people write partial sentences. - punctuating and capitalizing them as though they are complete sentences.
Comments to me are usually partial thoughts rather than complete sentences like
if(ptr) { // if not out of mem
memcpy(buf,ptr,sizeof(buf)); // copy it
}
Like that, so that's why I do not punctuate
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Exactly ... missing punctuation (for me) is an incomplete thought.
My comments are comments; and sometimes they are instructions; and sometimes they are warnings. Anything else is noise.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
The code looks clear enough, but why are you using all those C-language headers in C++ code? I started to read the documentation and like the structure, but it would take me far too long to read (and understand) the entire document. First impressions are that it is well presented and clearly written. My only negative comment is the light text on a dark background (but that's just me). Overall I would say it looks like you have worked hard on this.
[edit]
Mea culpa! I just found the "dark to light" switch.
And on a further read (as someone who is rubbish at documentation) I am impressed by the quality.
[/edit]
modified 5-Oct-23 3:19am.
|
|
|
|
|
Thanks. The reason for the C headers is zero-overhead C++ without the STL is my typical environment because of IoT and embedded. That resolves to "Cish" C++.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
honey the codewitch wrote: I was wondering how difficult it is to follow
Presuming it is the docs and not the code...
Some review comments...(I didn't review completely - just randomly jumping around.)
I suggest that you use a different name than 'GFX'. Possible that you might even be required to since a company uses that. Also makes it easier to google for information on it if it much more unique.
You just start right up into what I can only presume is the setup. I say presumably because you do not actually state that. As an intro? example there should only be one example.
Myself I prefer that code blocks are indented from explaining text.
There is nothing in the entire document about exceptions or errors. Nor troubleshooting.
----------------------------------
Pixels
Intro is a bit odd.
There are subsections but those are not in the table of contents?
Pixels section is also hanging out by itself in table of contents.
Perhaps Pixels should be under 'Addendum'? Seems like it might fit.
Arduino TFT Bus
Lots of stuff like 'PIN_NUM_CS' in code. Is that a stand in for actual hard value? A macro that user must define? From the library (your library) that you reference?
Streams
This seems extreme. Anyone that is going to be using this successfully needs to already understand a fairly high level of programming. So is this section needed?
Suspend and Resume
What happens if there is a suspend but then I want to stop completely?
Drivers
This is in the wrong location based on the content (sparse). This and what you put in the header suggests you need a section on setting up to use the library including decisions (with examples) that one might make.
Tools
Fontgen seems to make sense to me but Bingen doesn't.
Always concerning to me when header files initialize data. Which is what the text seems to suggest with 'test_dat_stream'?
There is an odd 'performance' link at the bottom of this page?
|
|
|
|
|
Thanks! I'll bookmark this feedback and use it when I do a doc update.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Regarding your comments on my use of x and y , I honestly can't think of a more descriptive name for them, as they translate directly to 2D cartesian coordinates*. In math that's x and y.
*y is inverted.
Anyway, do you have suggestions for those, as I am drawing a blank?
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
honey the codewitch wrote: Anyway, do you have suggestions for those, as I am drawing a blank?
There's always abcissa and ordinate, but that's getting just a wee bit pedantic, in my opinion. I think that anyone familiar with the problem space would probably expect the use of x, y (and z) for cartesian coordinates. At the very least, they shouldn't be confused by it. Just as you wouldn't expect someone to be confused by the use of (theta,r) for polar coordinates, or F=m*a, etc.
Keep Calm and Carry On
|
|
|
|
|
x and y it is (X and Y as properties) ... and often, accompanied by Left and Top. And you should be aware when they correspond. x and y can also simply mean displacements.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
I think anyone who works, or wants to, with computer graphics, will understand the use of x and y addressing.
|
|
|
|
|
honey the codewitch wrote: Regarding your comments on my use of x and y
Me? I don't think I said anything about that.
|
|
|
|
|
I could have sworn you did, but sure enough you did not.
I can't find it on this thread, so I don't know where I got that. Sorry!
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|