mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-27 05:04:01 +08:00
Some refactoring. Added a define for the default callresult/callback timeout.
This commit is contained in:
parent
25d53b6542
commit
beffb89bda
24
dll/base.cpp
24
dll/base.cpp
@ -191,6 +191,19 @@ std::string get_lib_path() {
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string get_full_lib_path()
|
||||
{
|
||||
std::string program_path;
|
||||
#if defined(STEAM_WIN32)
|
||||
char DllPath[MAX_PATH] = {0};
|
||||
GetModuleFileName((HINSTANCE)&__ImageBase, DllPath, _countof(DllPath));
|
||||
program_path = DllPath;
|
||||
#else
|
||||
program_path = get_lib_path();
|
||||
#endif
|
||||
return program_path;
|
||||
}
|
||||
|
||||
std::string get_full_program_path()
|
||||
{
|
||||
std::string env_program_path = get_env_variable("SteamAppPath");
|
||||
@ -203,15 +216,8 @@ std::string get_full_program_path()
|
||||
}
|
||||
|
||||
std::string program_path;
|
||||
#if defined(STEAM_WIN32)
|
||||
char DllPath[MAX_PATH] = {0};
|
||||
GetModuleFileName((HINSTANCE)&__ImageBase, DllPath, _countof(DllPath));
|
||||
program_path = DllPath;
|
||||
#else
|
||||
program_path = get_lib_path();
|
||||
#endif
|
||||
program_path = program_path.substr(0, program_path.rfind(PATH_SEPARATOR)).append(PATH_SEPARATOR);
|
||||
return program_path;
|
||||
program_path = get_full_lib_path();
|
||||
return program_path.substr(0, program_path.rfind(PATH_SEPARATOR)).append(PATH_SEPARATOR);
|
||||
}
|
||||
|
||||
std::string get_current_path()
|
||||
|
11
dll/base.h
11
dll/base.h
@ -161,10 +161,13 @@ CSteamID generate_steam_id_user();
|
||||
CSteamID generate_steam_id_server();
|
||||
CSteamID generate_steam_id_anonserver();
|
||||
CSteamID generate_steam_id_lobby();
|
||||
std::string get_full_lib_path();
|
||||
std::string get_full_program_path();
|
||||
std::string get_current_path();
|
||||
std::string canonical_path(std::string path);
|
||||
|
||||
#define DEFAULT_CB_TIMEOUT 0.002
|
||||
|
||||
class SteamCallResults {
|
||||
std::vector<struct Steam_Call_Result> callresults;
|
||||
std::vector<class CCallbackBase *> completed_callbacks;
|
||||
@ -238,7 +241,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
SteamAPICall_t addCallResult(SteamAPICall_t api_call, int iCallback, void *result, unsigned int size, double timeout=0.0, bool run_call_completed_cb=true) {
|
||||
SteamAPICall_t addCallResult(SteamAPICall_t api_call, int iCallback, void *result, unsigned int size, double timeout=DEFAULT_CB_TIMEOUT, bool run_call_completed_cb=true) {
|
||||
auto cb_result = std::find_if(callresults.begin(), callresults.end(), [api_call](struct Steam_Call_Result const& item) { return item.api_call == api_call; });
|
||||
if (cb_result != callresults.end()) {
|
||||
if (cb_result->reserved) {
|
||||
@ -266,7 +269,7 @@ public:
|
||||
return callresults.back().api_call;
|
||||
}
|
||||
|
||||
SteamAPICall_t addCallResult(int iCallback, void *result, unsigned int size, double timeout=0.0, bool run_call_completed_cb=true) {
|
||||
SteamAPICall_t addCallResult(int iCallback, void *result, unsigned int size, double timeout=DEFAULT_CB_TIMEOUT, bool run_call_completed_cb=true) {
|
||||
return addCallResult(generate_steam_api_call_id(), iCallback, result, size, timeout, run_call_completed_cb);
|
||||
}
|
||||
|
||||
@ -419,11 +422,11 @@ public:
|
||||
}
|
||||
|
||||
void addCBResult(int iCallback, void *result, unsigned int size) {
|
||||
addCBResult(iCallback, result, size, 0.0, false);
|
||||
addCBResult(iCallback, result, size, DEFAULT_CB_TIMEOUT, false);
|
||||
}
|
||||
|
||||
void addCBResult(int iCallback, void *result, unsigned int size, bool dont_post_if_already) {
|
||||
addCBResult(iCallback, result, size, 0.0, dont_post_if_already);
|
||||
addCBResult(iCallback, result, size, DEFAULT_CB_TIMEOUT, dont_post_if_already);
|
||||
}
|
||||
|
||||
void addCBResult(int iCallback, void *result, unsigned int size, double timeout) {
|
||||
|
Loading…
Reference in New Issue
Block a user