mirror of
https://github.com/zebrajr/SamRewritten.git
synced 2025-12-06 00:19:47 +01:00
Printing with --ls works
This commit is contained in:
parent
ccffa9da6b
commit
65d25d92b0
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
|
@ -10,7 +10,7 @@
|
|||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/bin/samrewritten",
|
||||
"args": ["206690", "--ls"],
|
||||
"args": ["730", "--ls"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "../controller/MySteam.h"
|
||||
#include "../globals.h"
|
||||
#include "../common/cxxopts.hpp"
|
||||
#include "../common/functions.h"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
|
@ -108,12 +109,6 @@ bool go_cli_mode(int argc, char* argv[]) {
|
|||
auto achievements = g_steam->get_achievements();
|
||||
auto stats = g_steam->get_stats();
|
||||
g_steam->quit_game();
|
||||
|
||||
for (auto stat : stats )
|
||||
{
|
||||
std::cout << stat.id << std::endl;
|
||||
}
|
||||
|
||||
|
||||
if (result.count("sort") > 0)
|
||||
{
|
||||
|
|
@ -128,7 +123,7 @@ bool go_cli_mode(int argc, char* argv[]) {
|
|||
|
||||
|
||||
// https://github.com/haarcuba/cpp-text-table -> worth? nah but best I've found
|
||||
std::cout << "API Name \t\tName \t\tDescription \t\tUnlock rate \t\tUnlocked" << std::endl;
|
||||
std::cout << "API Name \t\tName \t\tDescription \t\tUnlock rate \t\tUnlocked\n";
|
||||
std::cout << "--------------------------------------------------------------" << std::endl;
|
||||
for ( Achievement_t& it : achievements )
|
||||
{
|
||||
|
|
@ -139,6 +134,28 @@ bool go_cli_mode(int argc, char* argv[]) {
|
|||
<< it.global_achieved_rate << "% \t"
|
||||
<< (it.achieved ? "✔️" : "❌") << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "\n";
|
||||
|
||||
if ( stats.size() == 0 )
|
||||
{
|
||||
std::cout << "No stats found for this app.." << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "\nSTATS\n";
|
||||
std::cout << "API Name \t\tValue \t\t Increment Only\n";
|
||||
std::cout << "----------------------------------------" << std::endl;
|
||||
for (auto stat : stats )
|
||||
{
|
||||
std::cout
|
||||
<< stat.id << " \t"
|
||||
<< GET_STAT_VALUE(stat) << " \t"
|
||||
<< (stat.incrementonly ? "Yes" : "No")
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (result.count("unlock") > 0)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,13 @@
|
|||
#include "../globals.h"
|
||||
#include "../../steam/steam_api.h"
|
||||
|
||||
/**
|
||||
* Stats hold a value of type any, but can be either int or float.
|
||||
* This macro casts the value to the right type.
|
||||
* The cast types are the ones used by YAJL
|
||||
*/
|
||||
#define GET_STAT_VALUE(stat) (stat.type == UserStatType::Integer ? std::any_cast<long long>(stat.value) : std::any_cast<double>(stat.value))
|
||||
|
||||
/**
|
||||
* Wrapper for fork()
|
||||
*/
|
||||
|
|
@ -64,4 +71,4 @@ void escape_html(std::string& data);
|
|||
* Show a regular dialog box. Return value is ignored for now,
|
||||
* but feel free to add functionnlitie to this
|
||||
*/
|
||||
int zenity(const std::string text = "An internal error occurred, please open a Github issue with the console output to get it fixed!", const std::string type = "--error --no-wrap");
|
||||
int zenity(const std::string text = "An internal error occurred, please open a Github issue with the console output to get it fixed!", const std::string type = "--error --no-wrap");
|
||||
|
|
@ -121,7 +121,7 @@ encode_stat(yajl_gen handle, StatValue_t stat) {
|
|||
}
|
||||
else if ( stat.type == UserStatType::Float )
|
||||
{
|
||||
int value = std::any_cast<float>(stat.value);
|
||||
float value = std::any_cast<float>(stat.value);
|
||||
|
||||
yajl_gen_string_wrap(handle, STAT_VALUE_STR);
|
||||
if (yajl_gen_double(handle, value) != yajl_gen_status_ok) {
|
||||
|
|
|
|||
|
|
@ -255,7 +255,10 @@ MyGameSocket::OnGlobalStatsReceived(GlobalStatsReceived_t *callback, bool bIOFai
|
|||
std::cerr << "GlobalStatsReceived_t failed! Enum: " << callback->m_eResult << std::endl;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CERR
|
||||
std::cout << "Got stats, maybe I can do cool stuff with them, gotta check." << std::endl;
|
||||
#endif
|
||||
|
||||
m_global_callback_received = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,9 @@ MyServerSocket::run_server()
|
|||
|
||||
if (quit)
|
||||
{
|
||||
#ifdef DEBUG_CERR
|
||||
std::cout << "Shutting down server safely." << std:: endl;
|
||||
#endif
|
||||
// destruction of this object will take care of shutdown
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user