Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

C++ How to call a function / Edit a value in c++ from c#

TableFlipGod

Bronze Coder
So currently I have a project that wraps around this open source program : Here.

And I want my form radio button to set the cap to 30 fps or 60 fps. There is a config type thing in the code shown here
[CODE title="Code" highlight="34-38, 8-20"]#include <d3d11.h>
#pragma comment(lib, "d3d11.lib")

#include "sigscan.h"
#include "../injector/mapping.h"

#pragma pack(push, 1)
extern struct SettingsIPC
{
bool vsync_enabled;
double fps_cap;

struct
{
int scan_result;
void *scheduler;
int sfd_offset;
int present_count;
} debug;
};
#pragma pack(pop)

HMODULE MainModule = NULL;
HANDLE SingletonMutex = NULL;
uintptr_t TaskScheduler = 0;
int TaskSchedulerFrameDelayOffset = 0;
FileMapping IPC;

extern void WINAPI DllInit();
void WINAPI DllExit();



extern void SetFPSCap(int cap)
{
SettingsIPC fpscapper;
fpscapper.fps_cap = cap;
}

inline SettingsIPC* GetIPC()
{
return IPC.Get<SettingsIPC *>();
}[/CODE]


I also get this error when running a function:

System.EntryPointNotFoundException: 'Unable to find an entry point named 'SetFPSCap' in DLL 'rbxfpsunlocker.dll'.'

Code:
[DllImport("rbxfpsunlocker.dll", CallingConvention = CallingConvention.Winapi)]
        static extern void SetFPSCap(int cap);



I have no idea how to set these values from c# using dll import. I did try to make a function as you can see from extern void SetFPSCap(int cap) that it failed horribly.


So how would i run functions from c#?
 
Last edited:
Also what is that #cplusplus thing about?
I think you're referring to the #ifdef __cplusplus code that's in the C++ source files. It's something that used to be done when mixing C and C++ modules. I guess it's still possible to compile a C file in Visual Studio, but I can't find the project or compiler settings that would let you specifically define the code type within the source file (being either C or C++). I guess the compiler and environment is relying on the filename extension to determine the compile type to use.
The Stack Overflow link should give you enough information, but the gist of it is that this macro is defined when the file is being compiled as a C++ module. If this macro is defined, the code between the #ifdef and the #endif will be included as part of the compile, in this case the extern "C" stuff.
(that sounded rambling ... it's a Monday morning and my brain is foggy)
 
I did a bit of a dig into the rbxfpsunlocker repo you referenced, and one of it's dependencies is a Blackbone library, which describes itself as a "Windows memory hacking library". Once you start dealing with sketchy things that aren't expected by the OS you start fighting with things that would probably start to make your system more unstable (or I'd prefer not to tinker with things beyond my current comprehension). This approach makes injecting a DLL into Roblox a more attractive option in my opinion.
The things that Blackbone seem to allow you to do sounds interesting (not that I have a decent grasp of what's being described) but that rabbit hole of intrigue is outside the scope of time that I could allocate to it.
 
I did a bit of a dig into the rbxfpsunlocker repo you referenced, and one of it's dependencies is a Blackbone library, which describes itself as a "Windows memory hacking library". Once you start dealing with sketchy things that aren't expected by the OS you start fighting with things that would probably start to make your system more unstable (or I'd prefer not to tinker with things beyond my current comprehension). This approach makes injecting a DLL into Roblox a more attractive option in my opinion.
The things that Blackbone seem to allow you to do sounds interesting (not that I have a decent grasp of what's being described) but that rabbit hole of intrigue is outside the scope of time that I could allocate to it.
Ill just remove this feature because its not really useful.
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom